How to reset someone's stats if they aren't in the server [SOLVED]

It works! The only problem with this is that it only works when the user is not in the game. That means if they are in the game, it won’t work if I ran this while they were playing the game, without me in the server with them. I need this to run globally. For instance, if they are in a different server and I’m in my private server, it will reset their data. I need it to do that too.

If they’re in the game with you just set their leaderboard value to 0.

game.Players["Emeryund"]["leaderstats"]["Coins"].Value = 0

If they’re in another server and you want to modify them regardless, you would have to use MessagingService

1 Like

Oh, I didn’t know about MessagingService. Thanks for providing that information so I can reset the data with that.

Other than that, this topic has been solved then. Thank you very much for the support on this question! I would mark both of the responses you said with Solution but I can’t do that.

1 Like

you can try this:
this is a serverscript in serverscriptservice:

local ms = game:GetService("MessagingService")

ms:SubscribeAsync("Wipe Data", function(player)
    if not game.Players:FindFirstChild(player) then return end
    player = game.Players[player]
    player.leaderstats.Coins.Value = 0
end)

in the developer console, run this:

game:GetService("MessagingService"):PublishAsync("Wipe Data", "targetname")
2 Likes

Thank you for providing me the MessageService script. I will use that too!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.