RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make me advanced admin chat commands with at least 5 admin commands - add comments/instructions"
-- Server script for advanced admin chat commands local admins = {"Admin1", "Admin2", "Admin3"} -- Add admin usernames here local commands = { ["kick"] = function(player, targetName) local target = game.Players:FindFirstChild(targetName) if target then target:Kick("You have been kicked by an admin.") end end, ["ban"] = function(player, targetName) local target = game.Players:FindFirstChild(targetName) if target then target:Kick("You have been banned by an admin.") table.insert(bannedPlayers, targetName) end end, ["teleport"] = function(player, targetName) local target = game.Players:FindFirstChild(targetName) if target and target.Character and player.Character then player.Character.HumanoidRootPart.CFrame = target.Character.HumanoidRootPart.CFrame end end, ["health"] = function(player, amount) if player.Character and player.Character:FindFirstChild("Humanoid") then player.Character.Humanoid.Health = tonumber(amount) end end, ["speed"] = function(player, speed) if player.Character and player.Character:FindFirstChild("Humanoid") then player.Character.Humanoid.WalkSpeed = tonumber(speed) end end } local function onChatted(player, message) local args = {} for word in message:gmatch("%S+") do table.insert(args, word) end local command = args[1] local isAdmin = false for _, admin in ipairs(admins) do if player.Name == admin then isAdmin = true break end end if isAdmin and commands[command] then table.remove(args, 1) commands[command](player, unpack(args)) end end game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(message) onChatted(player, message) end) end)