UserBan
Represents a banned user record with ban details.
Returned by Moderation.GetBannedUsers() for moderation management.
Available on: Server scripts only
Properties
The User object of the moderator who issued the ban. Contains Name, Id, IsSubscriber, and IsAgeVerifiedAbove18.
print("Banned by: " .. ban.bannedBy.name)
Unix timestamp (seconds since epoch) when the ban was created. Use with os.date() to format as human-readable date.
local banDate = os.date("%Y-%m-%d %H:%M:%S", ban.createdAt)
print("Banned on: " .. banDate)
-- Calculate how long ago the ban was issued
local timeSinceBan = os.time() - ban.createdAt
print("Banned " .. timeSinceBan .. " seconds ago")
Unix timestamp (seconds since epoch) when the ban will expire. Will be infinity (math.huge) for permanent bans.
if ban.expiresAt == math.huge then
print("Permanent ban")
else
local expireDate = os.date("%Y-%m-%d %H:%M:%S", ban.expiresAt)
print("Expires on: " .. expireDate)
-- Calculate remaining time
local timeRemaining = ban.expiresAt - os.time()
if timeRemaining > 0 then
print("Time remaining: " .. timeRemaining .. " seconds")
else
print("Ban has expired")
end
end
The reason message provided when the ban was issued. May be empty if no reason was specified.
if ban.message ~= "" then
print("Ban reason: " .. ban.message)
else
print("No reason provided")
end
The User object of the banned player. Contains Name, Id, IsSubscriber, and IsAgeVerifiedAbove18.
local bannedUser = ban.user
print("Banned user: " .. bannedUser.name)
print("User ID: " .. bannedUser.id)
Updated 13 days ago