How to share player records between Roblox games with scoped user ids

Once scoped user ids roll out, the same number can be a different player in each game. How to key shared bans, balances and perks so they reach the right player.

warningLuaudit check: cross-game-user-ids

What it looks like

A game shares records with the owner's other games through a web service: coins or tickets that carry over, a ban list, a staff list, supporter perks. The records are keyed by the bare number from player.UserId or player.User.Id, so whichever game a number was written in, every game reads it as the same player.

Luau
local url = `{sharedApi}/wallets/{player.UserId}`

What an exploiter could do

Once scoped ids roll out, a post-rollout player in one game can hold the same number as a different player in another. Nobody has to plan it: whoever holds the number is treated as the other player. They spend that player's shared coins or tickets, get their staff powers or perks, or are kicked by their ban, while the banned player joins the other game under a new number and walks straight in. A player who notices the mix-up can keep collecting from someone else's record.

How to fix it

  • Key every record that leaves the game by player.User:ToString(), and compare it with ToString() of the player who joins. The guide recommends this whenever another domain reads the stored identity.
  • Keep shared progress inside one experience where you can. Places of one experience share a domain, data stores and user ids.
  • Give staff powers that span several games through group roles. The guide says IsInGroupAsync, GetRankInGroupAsync and GetRoleInGroupAsync "resolve identity internally without exposing a user ID".
  • Expect a record to stop matching across games. Scoped ids are designed so activity in one experience can't be tied to another "using the user ID alone", so a ban meant for several games has to be made in each of them, for example with Players:BanAsync.

Vulnerable example

Vulnerable
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")

local sharedBans = "https://example.com/our-games/bans"
local token = HttpService:GetSecret("BansToken")

Players.PlayerAdded:Connect(function(player)
	local ok, response = pcall(HttpService.RequestAsync, HttpService, {
		Url = `{sharedBans}/{player.UserId}`,
		Method = "GET",
		Headers = { Authorization = token:AddPrefix("Bearer ") },
	})
	if ok and response.Success and response.Body == "banned" then
		player:Kick("You are banned from our games.")
	end
end)

Fixed example

Fixed
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")

local sharedBans = "https://example.com/our-games/bans"
local token = HttpService:GetSecret("BansToken")

Players.PlayerAdded:Connect(function(player)
	local ok, response = pcall(HttpService.RequestAsync, HttpService, {
		Url = `{sharedBans}/{player.User:ToString()}`,
		Method = "GET",
		Headers = { Authorization = token:AddPrefix("Bearer ") },
	})
	if ok and response.Success and response.Body == "banned" then
		player:Kick("You are banned from this game.")
	end
end)

How to spot this in your own scripts, and the cases that only look like it, are part of the Luaudit check your AI runs.