- What do you want to achieve?
I want to make a ban command in cmdr panel using roblox’s ban async - What is the issue?
I cant seem to figure out how to do it. - What solutions have you tried so far?
I have tried doing it by seeing the other code but did not work and there are not any tutorials that i found about it.
This is a simple code using roblox’s ban async in chat but i need to make it in Cmdr panel, please help me in this.
The Code:
local TCS = game:GetService(“TextChatService”)
local Players = game:GetService(“Players”)
TCS.BanChatCommand.Triggered:Connect(function(TextSource, ChatText)
if TextSource.UserId == 3908064382 then
local splitString = ChatText:split(" ")
local username = splitString[2]
local reason = splitString[4]
if not reason then
reason = "No Reason provided."
end
local duration = tonumber(splitString[3])
local ExcludeAlts = false
local PrivateReason = splitString[5]
if not PrivateReason then
PrivateReason = reason
end
local userId = Players:GetUserIdFromNameAsync(username)
Players:BanAsync({
UserIds = {userId},
DisplayReason = reason,
PrivateReason = PrivateReason,
Duration = duration,
ApplyToUniverse = true,
ExcludeAltAccounts = ExcludeAlts,
})
end
end)


