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

LeaderStats? How to record kills?

Asked by 8 years ago

I barely started learning about leaderboards and i want to know how can you record kills. This is what i got. I don't know what to go from there

game.Players.PlayerAdded:connect(function(player)
    local stat = Instance.new("IntValue", player)
    stat.Name = "leaderstats"
    local money = Instance.new("IntValue",stat)
    money.Name = "Money"
    money.Value = 20
    local kills = Instance.new("IntValue",stat)
    kills.Name = "Kills"
    kills.Value = 0
end)

2 answers

Log in to vote
0
Answered by 8 years ago

if someone's hp is 0 that means death?

Ad
Log in to vote
0
Answered by 8 years ago

Well, now that you have set up the leaderboard statistics for the player, you can now add a function that checks when the player gets a kill. The kill-checking script should be inside of the weapon that the player will be using. Preferably, after changing the health values in the weapon's script, have it check if the target died from that health value change (if Humanoid.Health <= 0 then)

0
Yes that's what i did, but it kept giving me Argument 1 errors and Player nil errors as well. GeezuzFusion 200 — 8y

Answer this question