Respawn button doesn't work

I created a simple respawn button, that checks if the player is dead.
If so, it will apear and allow the player to click it.

It shows up but doesn’t detect any clicks.

local button = script.Parent

while task.wait() do
	if game.Players.LocalPlayer.Character.Humanoid.Health == 0 then
		button.Parent.Visible = true
	else
		button.Parent.Visible = false
	end
end

button.Activated:Connect(function()
	print("click")
	game.ReplicatedStorage.LoadCharacter:FireServer(false)
end)

anyone knows why this happens?

can you show how it looks in explorer

You can use Humanoid.Died to detect if the player died.
Also make sure ResetOnSpawn is false in properties of the screengui.

image

ResetOnSpawn is disabled

i replaced the health check with humanoid.Died and now it works, thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.