RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a complexed admin script with multiple commands."
-- server script -- Set up the commands local Commands = { ["kick"] = function(player, reason) player:Kick(reason) end, ["ban"] = function(player, reason) player:Ban(reason) end, ["tp"] = function(player, target) player.Character:MoveTo(target.Character.Head.Position) end } -- Set up the admin list local Admins = { ["Admin1"] = true, ["Admin2"] = true } -- Set up the chat command game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(message) -- Check if the message starts with a command local command = message:sub(1, message:find(" ") - 1) if Commands[command] then -- Check if the player is an admin if Admins[player.Name] then -- Parse the command local args = {} for arg in message:gmatch("[^%s]+") do table.insert(args, arg) end -- Run the command Commands[command](player, unpack(args, 2)) end end end) end)