RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"im making my own admin give us a template to start me off"
```lua -- Basic admin commands template local admins = {"Player1", "Player2"} -- Add admin usernames here local function isAdmin(player) for _, admin in pairs(admins) do if player.Name == admin then return true end end return false end local function onChat(msg, player) if isAdmin(player) then if msg:lower() == "!kickall" then for _, p in pairs(game.Players:GetPlayers()) do if p ~= player then -- Prevent the admin from kicking themselves p:Kick("You have been kicked by an admin.") end end elseif msg:sub(1, 6):lower() == "!kick " then local name = msg:sub(7) local targetPlayer = game.Players:FindFirstChild(name) if targetPlayer then targetPlayer:Kick("You have been kicked by an admin.") else player:SendNotification("Player not found", "The player " .. name .. " does not exist or is not in the game.", 5) end -- Add more commands here end end end game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(msg) onChat(msg, player) end) end) ``` This template provides a basic framework for creating admin commands in Roblox. It includes an admin check function and examples of kick commands. You can extend this template by adding more commands as needed.