This localscript, located in the player itself, is supposed to activate when the player dies (by falling off the map usually)
local plr = script.Parent
local char = plr.Character
local hum = char.Humanoid
local stats = plr.leaderstats
local respawns = stats.Respawns
local function onDeath()
if hum.Health <= 0 then
if respawns.Value > 0 then
respawns.Value = respawns.Value - 1
for i,v in pairs(plr:GetChildren()) do if v:IsA("Sound") then repeat wait(0) v:Stop() until v:Stop() or not v.IsPlaying end end
plr.Backpack.Death:Play()
end
end
end
hum.Changed:connect(onDeath)
Doesn't seem to work at all however, and I'm not finding any errors in the output. Any help would be appreciated.
