Removing A Frame When A Player Clicks A Gui

In the StarterGui I have a frame called IntroFrame and in that I have a text button called X. Whenever I play the game and click the text button and error pops up saying:

20:30:06.306 - Players.Play_MazeOfHeck.PlayerGui.ScreenGui.IntroFrame.X.CloseBottonScript:2: attempt to index field ‘LocalPlayer’ (a nil value)

Script (In Text Button)

script.Parent.MouseButton1Click:Connect(function()

game.Players.LocalPlayer.PlayerGui.ScreenGui.IntroFrame.Visible = false

end)

The Localplayer cannot be accessed via a normal and or server script, try using a local script instead.

1 Like

Thanks! How do I make it so when the player joins back it won’t show again?

Do you mean as in after they respawn or as in once they close it for the first time and they leave the game and cant open it again. if you mean after they respawn then you can utilize the ScreenGui.ResetOnRespawn property, but if you are talking about making it so that it cannot show ever again you will probably have to use Datastores

1 Like