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

Leaderstats doesn't work in IF?

Asked by 8 years ago

Hello,

So I got piece of code:

if Survivor.Character.Humanoid.Health == 0 then
    Survivor.leaderstats.Deaths.Value = Survivor.leaderstats.Deaths.Value + 1
end

If player dies by object (ball example) then it doesn't add +1 in the Deaths on Leaderstats. Why that could be?

1 answer

Log in to vote
0
Answered by 8 years ago

Why don't you use Died event to check to see if the Player has died and if He or She has then Add one to the Death Value? Here forexample:

game:GetService('Players').PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
        Player.leaderstats.Death.Value = Player.leaderstats.Death.Value + 1
            print(Player.Name .. " has died!")
        end)
    end)
end)

~UserOnly16Charcters, Hoped I helped you to answer your question! If you have any further question, don't hesitate to comment below!!

Ad

Answer this question