PlayerAccountAge

This function returns the players account age in days.

Example Usage:

-- Getting ReplicatedStorage and Players service
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

-- Referencing Essentials
local Essentials = require(ReplicatedStorage.Essentials)

-- Creating a variable with the amount of account days we want the user to have
local allowedAccountAge = 5

-- On the player added event, we created a function that checks for the players account age
-- If the account age is less than 5 days old, we would kick the player with the reason given
Players.PlayerAdded:Connect(function(player: Player)
    if Essentials.PlayerAccountAge(player, true) < allowedAccountAge then
        player:Kick("Your Roblox account has to be at least 5 days old")
    end
end)

Parameters

player: Player

The specified player object.

debugging: bool

Sends an output log to your output window and developer console.

References

Last updated