I have tried creating an object that would open a GUI. I put in a click detector and a script. The script works flawlessly in studio, but not in-game. I have tried making the script a local script, but it still doesn't work. This is the script.
script.Parent.MouseClick:connect(function(player) player.PlayerGui.TING.TANG.Visible = not player.PlayerGui.TING.TANG.Visible end)
This is because on line 1, you’re using deprecated code. Change :connect to :Connect.
This doesn’t work because your game is FE enabled, which disallows the server to change the Gui (it shouldn’t be anyways!). Instead, use a RemoteEvent
and make the gui visible.
-- LocalScript inside TANG local rep = game:GetService"ReplicatedStorage" local remote = rep:WaitForChild"ShowGUI" remote.OnClientEvent:Connect(function() script.Parent.Visible = not script.Parent.Visible end)
ServerScript inside your click detector:
-- Server script, in your click detector local remote = Instance.new'RemoteEvent' remote.Name = 'ShowGUI' remote.Parent = game:GetService('ReplicatedStorage') local storage = "ReplicatedStorage" script.Parent.MouseClick:Connect(function(plr) -- Connect not connect game:GetService(storage):WaitForChild('ShowGUI'):FireClient(plr) end)