Hey, So I was wondering how do I make a script that would reset’s every players Kills and Deaths to 0 in the leaderboard?
if you only want to reset players on server, looping through players and setting their kills,deaths to 0 would be enough. to reset everyone you need to loop through the database
Only thing you need to do is loop through players and reset their values on the SERVER. When that happens, DataStoreService will notice the change because it happened on the server.
for i, player in pairs(game:GetService("Players"):GetPlayers()) do
if player:FindFirstChild("leaderstats") then
player.leaderstats.Deaths.Value = 0
player.leaderstats.Kills.Value = 0
end
end
2 Likes
it will only notice the change for the players that are online at the time code is running, offline players won’t be affected by that.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.