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 2 years ago
1local button1 = workspace["Tycoon Map"]["Start Pad 1"]
2local GUI = workspace.Parent.StarterGui["Type Menu GUI"]
3 
4local Start = function ()
5    if button1.Touched = true then
6        GUI.Enabled == true
7    end
8end
0
i dont think "Touched" is a property here. Lord_F1re 1 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Solution:

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

Answer this question