"Right to Erasure", Code doesn't work?

Greetings, today I’ve got a message about “Right to Erasure” and I’ve been trying to educate myself about it. I am not sure if the user got deleted now, I surfed through old posts and again, I am not sure if the user got deleted.

Users basically have been saying if an experience uses DataStore then you’ll have to run the command “DataStoreService:GetDataStore(“TimeStats”):RemoveAsync([User-Id])” now I have been trying to run the command but this big red line appears, saying:

DataStoreService:GetDataStore(“TimeStats”):RemoveAsync(the user id):1: attempt to index nil with ‘GetDataStore’

Here’s my code:

local DataStoreService = game:GetService(“DataStoreService”)
local DataStore = DataStoreService:GetDataStore(“TimeStats”)
game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new(“Folder”)
Leaderstats.Name = “leaderstats”
Leaderstats.Parent = Player
local Minutes = Instance.new(“IntValue”)
Minutes.Name = “Minutes”
Minutes.Value = 0
Minutes.Parent = Leaderstats
local Data = DataStore:GetAsync(Player.UserId)
if Data then
Minutes.Value = Data
end
coroutine.resume(coroutine.create(function()
while true do
wait(60)
Minutes.Value = Minutes.Value + 1
end
end))
end)
game.Players.PlayerRemoving:Connect(function(Player)
DataStore:SetAsync(Player.UserId, Player.leaderstats.Minutes.Value)
end)

Help would be appreciated!

1 Like

The Right to Erasure is a message given to a developer in requesting the ALL data of the specific player to be deleted from your experience. This is to comply the laws regarding of data Right to Erasure. This happens when the account is sanctioned to deletion.

If you know the name of your datastores, you would just use RemoveAsync from the Datastore with the Key you used for saving player data, with the key matching the UserId provided.

Unfortunately, I am clueless about scripting :sweat_smile:. To make it more simple, could I just remove the script entirely?

That’s not what you are supposed to do.

Let me say it again, it is a REQUEST TO DELETE A SPECIFIC USER’S DATA.

You are NOT supposed to delete your ENTIRE SCRIPT of handling data.

1 Like

I’m guessing you are trying to run this from the command line within Roblox Studio. Try this instead:

game.DataStoreService:GetDataStore("TimeStats"):RemoveAsync(USER_ID_HERE) -- replace with id

all I did was add game. to the start of the command, as that’s where services are located.

Also make sure you have it so that game has the setting Studio Access to API Services turned on, otherwise it will give you another error messaging saying it cannot write to datastore.

2 Likes

I hope that is right haha
image

How do I see if the user is gone from the DataStore?

Thank you for doing this, you rock!

1 Like

run this command:

print(game.DataStoreService:GetDataStore("TimeStats"):GetAsync(USER_ID_HERE)) -- remember to replace with id again

if it returns nil in the console, then it worked

No problem! Right to Erasures can be annoying, especially for non-experienced devs.

1 Like

Actually, when I tested it, it will just return a blank line if it is empty.

1 Like

I saw haha. Again, thank you, you’re a rockstar haha. :smile:

I should get started learning Lua sometime so I do not waste so much time from good devs helping beginners like me :rofl:

Hope you have a nice day!

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