How to ban the Player In script?
i dont know what i should write here
https://create.roblox.com/docs/reference/engine/classes/Players#BanAsync
Here’s a code sample from the documentation:
local Players = game:GetService("Players")
if shouldBeBanned(player) then
local banHistoryPages = Players:GetBanHistoryAsync(player.UserId)
local duration = 86400 -- 24 hours in seconds. Recommendation: use your own logic based off of user's BanHistory
local config: BanConfigType = {
UserIds = { player.UserId },
Duration = duration,
DisplayReason = "You violated community guideline #5",
PrivateReason = "Put anything here that the user should not know but is helpful for your records",
ExcludeAltAccounts = false,
ApplyToUniverse = true,
}
local success, err = pcall(function()
return Players:BanAsync(config)
end)
print(success, err)
end