Is it
function ConnectOnDeath()
I'm stuck in writing the code I'm doing. It makes a number in the GUI go down when you die.
This should help. You need to indicate what ConnectOnDeath()
is.
local player = game.Players.LocalPlayer function ConnectOnDeath() --Rest of Script if player.Character.Humanoid.Health == 0 then ConnectOnDeath() end
Here you go. Because your question wasn't very detailed this is the best i could get out of it.
This event triggers when a player dies.
game:GetService('Players').PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character:WaitForChild("Humanoid").Died:connect(function() print(player.Name .. " has died!") end) end) end)