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.
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:
local remote = Instance.new'RemoteEvent'
remote.Name = 'ShowGUI'
remote.Parent = game:GetService('ReplicatedStorage')
local storage = "ReplicatedStorage"
script.Parent.MouseClick:Connect(function(plr)
game:GetService(storage):WaitForChild('ShowGUI'):FireClient(plr)
end)
2 comments
Hey, hey. Hold on. The RemoteEvent should be created only once, because if LocalScript makes it then there will be 1 remoteevent per every player which was in game. Please change that, because it's important note. Script won't work when there is more than 1 player.
true^ let me fix it