Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

LeaderStats? How to record kills?

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

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)

1 comment

0

Yes that's what i did, but it kept giving me Argument 1 errors and Player nil errors as well.

This discussion is preserved as it was. New answers, comments, and votes are closed.