When a player dies, I want the Gui to reset. I can't use ResetOnSpawn because this breaks my loading screen. I decided to use the Humanoid.Died Signal. The print statements work, but I add a wait() that is game.Players.RespawnTime + 1. I'm not sure why any code after the wait doesn't execute. No errors in the output whatsoever.

local player = game.Players.LocalPlayer
local character = player.Character
local Humanoid = character:WaitForChild("Humanoid")
Humanoid.Died:Connect(function()
	print("OOF")
	wait(game.Players.RespawnTime+1)
	script.Parent.MainFrame.Visible = true
	print("GUI IS VISIBLE NOW.")
end)

3 comments

0

Nevermind, I overcomplicated it. I could just make the Visible property of the Frame to false, and then make it to true when the loading is done.

1

Also use the CharacterAdded event to wait until they respawn.

0

Alright