Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

No error, tryingt to add 1 to a leaderstat after player has died?

Asked by 3 years ago

game:GetService('Players').PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character:WaitForChild("Humanoid").Died:Connect(function() print("h") player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value + 1 end) end) end)
1
Is this a local script, or a server script? Manby7 32 — 3y
0
local Radiant_Sparkles 69 — 3y
1
Oh Manby7 32 — 3y

1 answer

Log in to vote
1
Answered by
Manby7 32
3 years ago

Put this script in ServerScriptService:

game:GetService("Players").PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        char:WaitForChild("Humanoid").Died:Connect(function()
            player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value + 1
        end)
    end)
end)

Hope it helps!

1
Make sure it is a normal script, not a local one Manby7 32 — 3y
0
aa, thanks Radiant_Sparkles 69 — 3y
Ad

Answer this question