How can I make my own admin command system?
Please don’t tell me to use HD Admin, Kohl’s Admin, any of those models that you can grab straight from the toolbox. I would like to make my own.
How can I make my own admin command system?
Please don’t tell me to use HD Admin, Kohl’s Admin, any of those models that you can grab straight from the toolbox. I would like to make my own.
You have to detect when someone of high authority in your game sends a message such as ;kick
local admins = {
"Owner" -- Change owner to ur name or an admin, add more if u want seperating them with a comma
}
game.Players.PlayerAdded:Connect(function(player)
if table.find(admins, player.Name) then
player.Chatted:Connect(function(msg)
local words = string.split(msg, " ")
if words[1] == ";kick" then
local playerToKick = game.Players[words[2]]
if playerToKick then
playerToKick:Kick("You have been kicked!")
end
end
end)
end
end)
How would I kick them for a certain reason?
Nevermind, found it out.
Edit: Did some research and changed
playerToKick:Kick(kickReason)
to
playerToKick:Kick(table.concat(words, " ", 3))
local admins = {
"Rescriptedd"
}
game.Players.PlayerAdded:Connect(function(player)
if table.find(admins, player.Name) then
player.Chatted:Connect(function(msg)
local words = string.split(msg, " ")
if words[1] == ";kick" then
local playerToKick = game.Players[words[2]]
local kickReason = words[3]
if playerToKick then
if kickReason then
playerToKick:Kick(table.concat(words, " ", 3))
return
end
playerToKick:Kick("You have been kicked!")
end
end
end)
end
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.