Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I clear one specific player's leaderstat, when they aren't in game?

Hello,

In my game, I accidentally gave a random user 1,000,000,000,000 kills (the leaderstat). They left the game afterwards, and I'm not sure how I can set their leaderstat to 0, without wiping everyone else's progress.

Thank you, KreativleV2

2 comments

0

GDS:SetAsync(User_key, 0). if you lack their unique identifier, I'm afraid your issue cannot be resolved—unless you're using an OrderedDataStore.

0

You can wipe their data via GDS:RemoveAsync(User_key).

2 answers

Just use a Script that sets that exact player's stats to zero! This is a Script that can go in Workspace or ServerScriptService.

local RUYGST = "" --Stands for Random User You Gave Stats To >:)
--RUYGST should be the player's name in exact capitals as it is spelled!
game.Players.PlayerAdded:Connect(function(player)
	if player.Name == RUYGST then
		player.leaderstats.kills.Value = 0
	end
end)

1 comment

0

Issue is this will take place the next time they join the game, not when they're not playing. So try to get them to join and their leaderstats will reset.

Use GlobalDataStore and the key to their DataStore and :SetAsync the value to 0 (if you’re using normal DataStores)

Otherwise, not sure.

This discussion is preserved as it was. New answers, comments, and votes are closed.