What is "userIds" used for in database?

When I try to do DataStore:SetAync() it gives me the option to add “userIds” too, but I don’t get what is used for? isn’t it the same as key?

2 Likes

using userids is the best way to separate data for each player

MainDSS:SetAsync("FoodItems", FoodItems)

is different from

MainDSS:SetAsync(Player.UserId.."FoodItems", FoodItems)

As you can now get the player userid when the player loads and load that one specific players info

(I’m not sure if this answered your question but elaborate if it didn’t)

2 Likes

It’s for GDPR compliance tracking, when a player requests to delete their account (right to erasure), any data regarding that player must be deleted. This includes datastores in games, so to make it easy to track and remove player’s data, you can use the userIds to do just that

1 Like

Thats not what he meant, he was referring to the third argument, which is:

MainDSS:SetAsync(`{player.UserId}FoodItems`, FoodItems, {Player.UserId})

The key can be changed in many different formats, it would be complicated for roblox to track it automatically; so to fix that, we can use a table containing the player userId

So when there is GDPR request, if i assigned to a player data a userid it would wipe the data automatically without farther action?

1 Like

Can’t say for sure, though the docs only stated that

Recommended to assist with with content copyright and intellectual property tracking/removal

Data Stores | Documentation - Roblox Creator Hub.

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