How do I remove a certain player from global leaderboard?

Howdy, I need help with this script (not made by me) how I remove a certain player from the global leaderboard?

image

Sorry for being greedy but, I also need help with turning it into an command without a player being in the game so, I can remove their global time.

2 Likes

If you wanna remove their global time just run this
DataStore:RemoveAsync(Player.UserId)

For turning it into a command, your gonna need a whole other script for that. Tell me what you wanna do first in terms of a command.

1 Like

DataStore:RemoveAsync(Player.UserId)
should I run that in the console command bar?

It’ll be way easier if it turns into a command, but I got no idea how to make it into a command pardon my lack of experience

I want the command to be like “:cleardata dwnh” and it resets their time to 0 even if they’re not in the game
image

Removing works best for this, as it will reset the data and rebuild it when they (if they) log back on. I also have a plugin called DataStore Editor that will let you see the data and manually edit it out.

I don’t have the Robux to buy that :confused:

I think there is a free one too. Just for a quick edit. Deleting the main key is how you do this. That will take everything within it also. Unless you’re looking to save the rest of the data.

I want to remove a certain player’s data without going through millions of search

Then just delete it.

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("TimeStats")

game.Players.PlayerAdded:Connect(function(player)
	DataStore:RemoveAsync(player.UserId)
end)

Run this on console command or make a separate script in serverscriptstorage

Think it works both ways. Maybe set up a testing program and do some tests.
That is a script there and will reset anyones data logging on.

What if they never log in? give themselve’s infinite time then never log in

That’s just a way to do it. You’ll need to figure out how to implement that. Possibly a reset on a ban trigger, like giving yourself infinite time.

You can run something like this in the developer console command line:

game:GetService("DatastoreService"):GetDataStore("TimeStats"):RemoveAsync(1234)

and maybe

print( game:GetService("Players"):GetUserIdFromNameAsync("dwnh") )

to get their userid.

(you can also run these in the studio command bar)

If you wanna make something into a command, use a script that checks the chat for a slash command and use that to check if your command equals what you want.