local player = game.Players.LocalPlayer
local char = player.Character
local storage = game:GetService("ReplicatedStorage")
char.Humanoid.Died:Connect(function()
for i,v in pairs(storage.Contestants:GetChildren()) do
if v.Name == player.Name then
v.Dead.Value = true
end
end
end)
This script only works once, then never works again. It is a localscript in StarterGui and this happens in both studio and in-game. Help?

1 comment
The reason it only works once is because once the player respawns a new character is created. You're only defining that one character once so every time you die it's getting that same characters humanoid (which is nil because it was destroyed after death). Use a playeradded event with a characteradded event inside of it checking when the humanoid dies. Hope this helps :)