I've been trying to create a script for part where, when touched, it opens a gui (shop), and when you step off of it, it turns off. However it doesn't work. Throws no errors.
local activate = script.Parent
activate.Touched:Connect(function()
game.StarterGui.Shop.Select.Visible = true
end)
activate.TouchEnded:Connect(function()
game.StarterGui.Shop.Select.Visible = false
end)
I've also tried this way, but then it throws an error saying PlayerGui is nil.
local activate = script.Parent
activate.Touched:Connect(function()
game.Players.LocalPlayer.PlayerGui.Shop.Select.Visible = true
end)
activate.TouchEnded:Connect(function()
game.Players.LocalPlayer.PlayerGui.Shop.Select.Visible = false
end)
Any suggestions? I'm using a regular script, not a local script.

1 comment
Solved it, just moved the script into the gui (changed the variables), and made it a localscript.