I was wondering what happens to GUIs located in PlayerGui when the player dies or respawns. My assumption was that the visible property becomes false when they do, so I made a script to keep the GUIs after the player respawns. However, the script didn't work so either my assumption was wrong or I just created the script incorrectly.

Here is my script:

game.Players.PlayerAdded:connect(function(plr)
	local character = plr.Character
	plr.CharacterAdded:connect(function(plr)
		local humanoid = character:WaitForChild("Humanoid")
		humanoid.Died:connect(function(plr)
			plr.PlayerGui.ClassGui.Covers.Visible = true
			plr.PlayerGui.ClassGui.Frame.Visible = true
			plr.PlayerGui.ClassGui.Main.Visible = true
		end)
	end)
end)

What happens to the GUIs in PlayerGui after the player respawns? Why doesn't my script work?

Thanks for the help!

1 comment

0

IF, if, StarterGui ResetPlayerGuiOnSpawn box has a check mark then, whatever is displayed on your screen when you edit will appear to the player again when the respawn, so you don't have to make a script for it.