How to Remove GUI and Respawn Player after 'Play' Button is Pressed

Hi, I’m pretty new to Roblox scripting, and apologies in advance if I am being stupid/overlooking something really simple. I wanted to ask how I can remove the GUI and respawn a player after a TextButton is pressed. I decided to turn to the community, due to me being unable to find a suitable tutorial.



You can disable the gui on the client and fire a remote event to communicate to the server and you can load the character using player:LoadCharacter()

Like whale said, use player:LoadCharacter() and use script.Parent.Parent:Destroy() to destroy the gui or script.Parent.Parent.Enabled = false to make the guis inside of a gui invisible

It’s player:LoadCharacter() btw


Thank you for your responses - apologies if this was a really basic error - but I am new to scripting. Should this script go into my main GUI script (the MainMenuHandler) or a new script inside of the Menu ScreenGUI?

Well It’s really up to your choice

Alright, thank you for the help. I have kept this GUI in StarterGUI, is this fine or should I move it?

1 Like

It should go to your ‘play’ button

Okay. But, for the entire GUI (the whole menu) would it be fine to keep it in StarterGUI?

Thanks, sorry for the dumb questions.

Yeah it would be fine to keep it in StarterGUI since thats where you put all of your guis in there


Inside play button:

local btn = script.Parent

wait (1)	

Make sure Parent count is correct.

1 Like

Hi, thanks for all the responses - I managed to get it working now - thank you!


Make sure to mark an answer as the solution!

1 Like

Sorry, one more question - this does work, and removed the GUI - but I have a camera part, and the view is fixed - is there some way I can make it revert back to the player view when player is respawned?

Put this in a LocalScript in the spawn.

local camera = workspace.CurrentCamera

function Touch(hit) 
	camera.CameraType = Enum.CameraType.Custom
1 Like