Right to Erasure

Hello.

I´ve recieved this Roblox message.

I´d like to know how to delete the Data of that deleted player. I´ve been looking around some related topics, but I did not find anything useful.

What would happen if I could not remove the Data? I´ve read nothing will happen, but I´d like to fix this.

This is the script of the DataStore of my game:


local DataStoreService = game:GetService(“DataStoreService”)
local dataStore = DataStoreService:GetDataStore(“MyDataStore”)
local plr = game:GetService(“Players”)

local function saveData(player)

local tableToSave = {
	player.leaderstats.Exp.Value; 
	player.leaderstats.Level.Value; 
}

local success, err = pcall(function()
	dataStore:SetAsync(player.UserId, tableToSave) 
end)

if success then 
	print("Data has been saved!")
else 
	print("Data hasn't been saved!")
	warn(err)		
end

end

game.Players.PlayerAdded:Connect(function(player)

local data
local success, err = pcall(function()

	data = dataStore:GetAsync(player.UserId) 

end)

if success then 
	player.leaderstats.Exp.Value = data[1]
	player.leaderstats.Level.Value = data[2]
else
	print("The player has no data!")
end

end)

game.Players.PlayerRemoving:Connect(function(player)
local success, err = pcall(function()
saveData(player)
end)

if success then
	print("Data has been saved")
else
	print("Data has not been saved!")
end

end)

game:BindToClose(function()
for _, player in pairs(game.Players:GetPlayers()) do
local success, err = pcall(function()
saveData(player)
end)
if success then
print(“Data has been saved”)
else
print(“Data has not been saved!”)
end
end
end)


3 Likes

Hey pal, you can use :RemoveAsync()

The documentation basically just syas in a fancy way that it deletes the data of the user. Or in specific terms the data that has been saved to the unique key.

So, if you’ve been saving the data through userids (which you should’ve). Then all you need to do is something like this

Datastore:RemoveAsync(UserID)

And make sure you wrap it in a pcall.

Just write it in a random script and run it, then boom it’s gone.

1 Like

local DataStoreService = game:GetService(“DataStoreService”)

local DS = DataStoreService:GetDataStore(“MyDataStore”)

local success, removedValue = pcall(function()
return DS:RemoveAsync("User_ID)
end)

if success then
print(removedValue)
end


Should this work?
If it does, how would I know? Will the message Roblox sent me delete?

Hello. To remove an offlines player data, you can easily do Player:RemoveDatastore(). This clears the datastore that was ever created for the player.

How do I get the name of “Player”? Their account has been deleted/terminated.

You can use the UserID of the player and call this:

local UserID = 00000
Roblox.API:ClearDatastore(UserID)

Alr. I´ll try that right now.

But, how do I know if it worked? I don´t think that Roblox is gonna send me a message

You really don’t gotta delete the data, everyone gets it at some point, it’s pointless.

Well, Roblox does send a message when you clear the users data using its API.

Yes he does. If he does not remove the Users data from his experience, his account may undergo punishments.

Is that the full script? What do you mean with “Roblox.Api”, how do I use it?

Well, all you need to do is replace the “00000” with the ID you want to clear of the users data. Then, run this in the console on the server. Not in studio.

The thing is. For example, I don´t think that big developers would spend time deleting the data of deleted/terminated players every day

When a “Right to Erase” request is received, you may ignore it. This has no affect on your accounts history.

It says there is an error with API

Captura de pantalla 2024-07-01 234910

Sorry for the misunderstanding, this is the right fixed code.

local UserID = 00000
local APIService = Game:GetService("RobloxAPI")

APIService:DestroyAllDatastores(UserID)

Captura de pantalla 2024-07-01 235331

Don’t listen to @Miserable_Haven the code he is giving you makes no sense whatsoever

As pointed out by @Amritss, you can use :RemoveAsync() like so

local DataStoreService = game:GetService("DataStoreService")
local dataStore = DataStoreService:GetDataStore("MyDataStore")

local UserId = 000000 -- Put the UserId of the player in the Right To Erasure request

local success, err = pcall(function()
	dataStore:RemoveAsync(UserId) 
end)

if success then 
	print("Data has been cleared!")
else 
	print("Data hasn't been cleared!")
	warn(err)		
end

Change 000000 to the UserId and paste this code in the developer console, in studio or in a live game

1 Like

Sorry, I meant to type “ROBLOXAPI” in capitals, try that.

What are you on, ROBLOXAPI is not a thing. And requests to the actual Roblox api can’t be done from within roblox

1 Like