Answered by
6 years ago Edited 6 years ago
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.
3 | local rep = game:GetService "ReplicatedStorage" |
4 | local remote = rep:WaitForChild "ShowGUI" |
6 | remote.OnClientEvent:Connect( function () |
7 | script.Parent.Visible = not script.Parent.Visible |
ServerScript inside your click detector:
03 | local remote = Instance.new 'RemoteEvent' |
04 | remote.Name = 'ShowGUI' |
05 | remote.Parent = game:GetService( 'ReplicatedStorage' ) |
06 | local storage = "ReplicatedStorage" |
08 | script.Parent.MouseClick:Connect( function (plr) |
09 | game:GetService(storage):WaitForChild( 'ShowGUI' ):FireClient(plr) |