Im trying to make a round game similar to item asylum and after each round i want to reset the leaderboard stats of every player.
COMMUNITY QUESTION
how to set all leaderboard stats to 0?
3 answers
You could do something like -
Local players = game: GetService("Players")
Local playersArray = players:GetChildren ()
For I, plrs in pairs(playersArray) do
plrs.leaderstats.Money.Value = 0
End
Hello, I don't mean to be a pest but, ScriptingHelpers.org is not a website to get scripts, It's a place to ask developers why your script isn't working, but enough of that, here's a script
We use something called a for loop, a foor loop loops through every single item in the thing you want to search, so say you have a Folder full of parts and want to count how many their are, you use a for loop to get all of the objects in the folder and add one to the count and after the loop it shows how many there was!
Script:
local PlayersService = game:GetService("Players")
local leaderstatName = "Money" -- Change to the leaderstat name of the leaderstat you wanna change
for _, player in pairs(PlayersService:GetPlayers()) do
if player then
player.leadersats[leaderstatName].Value = 0
end
end
hey you! have you ever heard of enes? if you are in trouble, better call enes!
This discussion is preserved as it was. New answers, comments, and votes are closed.
