Here is my code (This Opens the GUI, Uses Normal Script)
script.Parent.MouseClick:Connect(function(Player) print(Player.Name) game.Players[Player.Name].PlayerGui.ScreenGui.Frame.Visible = true end)
I use my close button: (Uses LocalScript)
script.Parent.MouseButton1Click:Connect(function() game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false end)
After I open the GUI and close it, If I try to open it again it just won't open, It still prints my name and doesn't show any errors.
Anybody know why?
In your first script, MouseClick isn't a valid member of a GUI. You also can't have a player argument. GUIs are always supposed to work from LocalScripts
because they run on the Client and never on the Server. Have your first script be a LocalScript
and use .MouseButton1Click
instead.
script.Parent.MouseButton1Click:Connect(function() print(game.Players.LocalPlayer.Name) game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true end)
I had a similar problem, you can't open and close the script on two types of scripts, you have to single it out to one type. Its because its still open on the server side of it but not locally.