screenGUI wont be enabled after clicked event

Hey! I am working on a loading screen and after you click the ‘Credits button’ the credits GUI is supposed to show up. However once pressed the menu GUI will disappear and the Credits gui doesn’t appear. script:


	script.Parent.Enabled = false
	game.StarterGui.CreditsGui.ScreenGui.Enabled = true

No errors in the output either.

1 Like

StarterGui is used as a source container and all its contents are copied locally to game.Players.LocalPlayer.PlayerGui upon spawning. The ResetOnSpawn property of GUIs determine whether or not to re-copy them on respawning.


I used a local script so will it still only show for the player? I have tested it on my alt on a testing game and it doesn’t show up for my alt.

LocalScript is correct, but you should refer to game.Players.LocalPlayer.PlayerGui rather than game.StarterGui

1 Like

My guess is line 2: script.Parent:Destroy()

When you destroy anything all of its children get destroyed also. This means that this script will not continue running past line 2 because the script does not exist.

Try running this script again and checking if the script exists after you press the PlayButton. If it doesn’t, then you’ve found the problem.

My menu consists of 2 buttons, the credits and PlayButton. What could be the error?

Never mind; @Flubberlutsch’s solution is a lot better. I incorrectly assumed the script was a child of one of the Gui.

1 Like

game.StarterGui isn’t available within game. Each player joined will have those assets from that replicated into game.Players.LocalPlayer.PlayerGui

This also requires a local script to work.

Couldn’t you just replace “UserHere” with LocalPlayer? It’d be a lot easier to just call the player on the client instead of individual players.

Yeah i didn’t realise my mistake.

1 Like

I fixed it by making the creditsGui a child to the menu gui.