Player names change and get recycled — UserId is the number that identifies one person forever.
Every Roblox account has a UserId: a number that identifies that person forever, across every game, and never changes. When your game needs to remember which player is which, this number is the answer.
Every player has it:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
print(player.Name .. " has UserId " .. player.UserId)
end)
The Name is what you see ("Sam"), the UserId is the number underneath ("123456789"). Two different players can both be named "Sam" — but never the same UserId.
The property that gives a player their permanent, unique ID number is player.
Player names look unique, but they're a trap:
A UserId is assigned once, never changes, and is never reused. That's why it's the correct key for anything long-lived — saves, bans, leaderboards.
When a player joins, print a message that identifies them permanently. Build the message with .. and include their UserId.
Players.PlayerAdded:Connect(function(player)
-- your print here
end)