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)
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.
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.