How would I reset one value on the leaderboard?
Thanks!
How would I reset one value on the leaderboard?
Thanks!
Assuming you want to reset the stat for ALL players then what you have to do is..
1) Make a variable that contains the name of the leaderstat you wish to reset.
2) Use a generic for loop to iterate through a table full of all the Players in the server.
3) Set the leaderstat, stored in 'leaderstats', which is in the Player, to 0.
local stat = "Kills" --Name of stat to reset
local players = game.Players:GetPlayers() --All the players
for i,v in pairs(players) do --iterate through all players
if v.leaderstats then
local lstat = v.leaderstats:FindFirstChild(stat) --get the stat
if lstat then --check if stat exists
lstat.Value = 0 --Reset it
end
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.