'how do I make a buttonGUI that when clicked shows a GUI?
I would like this to be a buttonGUI or a proximity prompt (proximity prompt preferred)
Solution 1:[1]
You haven't given much context of the file structure, so I can only do my best to help.
So first you need to add a event listener to the button. So as a child of the button add a localscript
and in that script add the listener.
local GUI_Holder = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
local UI = GUI_Holder.Your_UI_To_Activate -- Path to the GUI element
script.Parent.MouseButton1Click:Connect(function()
UI.Enabled = true
end)
Lines one and two look pretty bad however you can replace then with you own way of fetching the UI. (https://developer.roblox.com/en-us/api-reference/class/TextButton)
If you need any more help reply to this :)
-- Harvey
Solution 2:[2]
Harvey has a good answer but I recommend using button.Activated
local GUI_Holder = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
local UI = GUI_Holder.Your_UI_To_Activate -- Path to the GUI element
script.Parent.Activated:Connect(function()
UI.Enabled = true
end)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Harvey |
Solution 2 | Whoman |