This member cannot be used in scripts, but is usable in the command bar and plugins.
The SetAccountAge function sets the
Player/AccountAge of the player in days.
It is used to set the
Player property that describes how long ago a player’s account was registered in days.
This does not set the age of the player on the account, but the age of the account itself relative to when it was first created.
The age of the account in days.
Setting the Player’s Account Age
This example demonstrates how the
Player/SetAccountAge function would be used if it was accessible. It sets the local player’s account age to 100 days.
local player = game.Players.LocalPlayer player:SetAccountAge(100)
Account Age Mark
This code sample adds a mark to players showing about how old their account is. The mark uses a player’s account age to determine if they are a New Player, Veteran Player or Regular Player.
local Players = game:GetService("Players") local MAX_AGE_NEW_PLAYER = 7 -- a week local MIN_AGE_VETERAN = 365 -- one year -- This function marks a part with text using a BillboardGui local function mark(part, text) local bbgui = Instance.new("BillboardGui") bbgui.AlwaysOnTop = true bbgui.StudsOffsetWorldSpace = Vector3.new(0, 2, 0) bbgui.Size = UDim2.new(0, 200, 0, 50) local textLabel = Instance.new("TextLabel") textLabel.Size = UDim2.new(1, 0, 1, 0) -- Fill parent textLabel.Text = text textLabel.TextColor3 = Color3.new(1, 1, 1) textLabel.TextStrokeTransparency = 0 textLabel.BackgroundTransparency = 1 textLabel.Parent = bbgui -- Add to part bbgui.Parent = part bbgui.Adornee = part end local function onPlayerSpawned(player, character) local head = character:WaitForChild("Head") if player.AccountAge >= MIN_AGE_VETERAN then mark(head, "Veteran Player") elseif player.AccountAge <= MAX_AGE_NEW_PLAYER then mark(head, "New Player") else mark(head, "Regular Player") end end local function onPlayerAdded(player) -- Listen for this player spawning if player.Character then onPlayerSpawned(player, player.Character) end player.CharacterAdded:Connect(function () onPlayerSpawned(player, player.Character) end) end -- Listen for players being added for _, player in pairs(Players:GetPlayers()) do onPlayerAdded(player) end Players.PlayerAdded:Connect(onPlayerAdded)