Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i open a gui menu on a button touch?

Asked by 1 year ago
local button1 = workspace["Tycoon Map"]["Start Pad 1"]
local GUI = workspace.Parent.StarterGui["Type Menu GUI"]

local Start = function ()
    if button1.Touched = true then
        GUI.Enabled == true
    end
end
0
i dont think "Touched" is a property here. Lord_F1re 1 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

Solution:

--Place this script inside the "Start Pad 1" part.

script.Parent.Touched:Connect(function(hit) --function fires when part is touched, no need for an if statement
    if not hit.Parent:FindFirstChild("Humanoid") then return end --making sure it's a human touching the part
    local plr = game.Players:GetPlayerFromCharacter(hit.Parent) --getting the player 
    local GUI = plr.PlayerGui:WaitForChild("Type Menu GUI")--Your gui, we need to do plr.PlayerGUI instead of plr.StarterGui
    GUI.Enabled = true

end)
Ad

Answer this question