-- Admin Script - Place in ServerScriptService local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") -- ========================= CONFIG ========================= local PREFIX = "!" -- Change to ":" or whatever you like local ADMINS = { -- Add usernames or UserIds here Owners = {123456789}, -- Your UserId or username Admins = {}, Mods = {}, } local function isAdmin(player, minRank) local rank = "Player" local id = player.UserId local name = player.Name if table.find(ADMINS.Owners, id) or table.find(ADMINS.Owners, name) then rank = "Owner" elseif table.find(ADMINS.Admins, id) or table.find(ADMINS.Admins, name) then rank = "Admin" elseif table.find(ADMINS.Mods, id) or table.find(ADMINS.Mods, name) then rank = "Mod" end local ranks = {Player = 0, Mod = 1, Admin = 2, Owner = 3} return ranks[rank] >= ranks[minRank or "Mod"] end local function findPlayer(name) name = name:lower() for _, plr in ipairs(Players:GetPlayers()) do if plr.Name:lower():find(name) or plr.Name:lower() == name then return plr end end return nil end local function notify(player, message, color) color = color or Color3.fromRGB(255, 255, 0) -- Simple chat notification (you can replace with a proper GUI if needed) if player then player:Kick("Admin Notification: " .. message) -- Temporary; replace with better UI wait(0.1) -- Avoid kick conflict if needed end print("[Admin] " .. message) end -- ======================= COMMANDS ======================= local Commands = {} Commands.kick = function(admin, targetName, reason) local target = findPlayer(targetName) if not target then return "Player not found" end if isAdmin(target, "Mod") then return "Cannot kick higher/equal rank" end reason = reason or "No reason given" target:Kick("Kicked by " .. admin.Name .. ": " .. reason) return target.Name .. " has been kicked." end Commands.ban = function(admin, targetName, timeMin, reason) -- timeMin optional local target = findPlayer(targetName) if not target then return "Player not found" end reason = reason or "No reason" -- Simple ban (use DataStore for persistence in real games) target:Kick("Banned by " .. admin.Name .. " for " .. (timeMin or "forever") .. " min: " .. reason) return target.Name .. " banned." end Commands.kill = function(admin, targetName) local target = findPlayer(targetName) or admin if target.Character and target.Character:FindFirstChild("Humanoid") then target.Character.Humanoid.Health = 0 return target.Name .. " killed." end return "No character found." end Commands.tp = function(admin, targetName1, targetName2) local p1 = findPlayer(targetName1) or admin local p2 = findPlayer(targetName2 or targetName1) if p1.Character and p2.Character and p2.Character:FindFirstChild("HumanoidRootPart") then p1.Character.HumanoidRootPart.CFrame = p2.Character.HumanoidRootPart.CFrame + Vector3.new(0, 3, 0) return p1.Name .. " teleported to " .. p2.Name end return "Failed to teleport." end Commands.speed = function(admin, targetName, speed) local target = findPlayer(targetName) or admin speed = tonumber(speed) or 16 if target.Character and target.Character:FindFirstChild("Humanoid") then target.Character.Humanoid.WalkSpeed = speed return target.Name .. " WalkSpeed set to " .. speed end return "Failed." end Commands.jump = function(admin, targetName, power) local target = findPlayer(targetName) or admin power = tonumber(power) or 50 if target.Character and target.Character:FindFirstChild("Humanoid") then target.Character.Humanoid.JumpPower = power return target.Name .. " JumpPower set to " .. power end return "Failed." end Commands.msg = function(admin, ...) local message = table.concat({...}, " ") for _, plr in ipairs(Players:GetPlayers()) do plr:SendNotification({Title = "Admin Message", Text = message, Duration = 10}) end return "Broadcast sent." end Commands.give = function(admin, targetName, toolName) -- Example: give a tool from ServerStorage or create one local target = findPlayer(targetName) or admin local tool = game.ServerStorage:FindFirstChild(toolName) or Instance.new("Tool") tool.Parent = target.Backpack return "Gave " .. toolName .. " to " .. target.Name end Commands.cmds = function(admin) local list = "Commands: kick, ban, kill, tp, speed, jump, msg, give, cmds" admin:SendNotification({Title = "Admin Commands", Text = list, Duration = 15}) return list end -- ======================= CHAT HANDLER ======================= Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(msg) if not msg:startsWith(PREFIX) then return end local args = msg:split(" ") local cmdName = args[1]:sub(#PREFIX + 1):lower() table.remove(args, 1) if not isAdmin(player) then player:SendNotification({Title = "Error", Text = "No permission."}) return end local commandFunc = Commands[cmdName] if commandFunc then local success, result = pcall(function() return commandFunc(player, unpack(args)) end) if success then print("[Admin Command] " .. player.Name .. " used " .. cmdName .. ": " .. (result or "Done")) else warn("Command error: " .. result) end else player:SendNotification({Title = "Unknown Command", Text = "Type " .. PREFIX .. "cmds"}) end end) end) print("Admin script loaded! Prefix: " .. PREFIX)-- Admin Script - Place in ServerScriptService local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") -- ========================= CONFIG ========================= local PREFIX = "!" -- Change to ":" or whatever you like local ADMINS = { -- Add usernames or UserIds here Owners = {123456789}, -- Your UserId or username Admins = {}, Mods = {}, } local function isAdmin(player, minRank) local rank = "Player" local id = player.UserId local name = player.Name if table.find(ADMINS.Owners, id) or table.find(ADMINS.Owners, name) then rank = "Owner" elseif table.find(ADMINS.Admins, id) or table.find(ADMINS.Admins, name) then rank = "Admin" elseif table.find(ADMINS.Mods, id) or table.find(ADMINS.Mods, name) then rank = "Mod" end local ranks = {Player = 0, Mod = 1, Admin = 2, Owner = 3} return ranks[rank] >= ranks[minRank or "Mod"] end local function findPlayer(name) name = name:lower() for _, plr in ipairs(Players:GetPlayers()) do if plr.Name:lower():find(name) or plr.Name:lower() == name then return plr end end return nil end local function notify(player, message, color) color = color or Color3.fromRGB(255, 255, 0) -- Simple chat notification (you can replace with a proper GUI if needed) if player then player:Kick("Admin Notification: " .. message) -- Temporary; replace with better UI wait(0.1) -- Avoid kick conflict if needed end print("[Admin] " .. message) end -- ======================= COMMANDS ======================= local Commands = {} Commands.kick = function(admin, targetName, reason) local target = findPlayer(targetName) if not target then return "Player not found" end if isAdmin(target, "Mod") then return "Cannot kick higher/equal rank" end reason = reason or "No reason given" target:Kick("Kicked by " .. admin.Name .. ": " .. reason) return target.Name .. " has been kicked." end Commands.ban = function(admin, targetName, timeMin, reason) -- timeMin optional local target = findPlayer(targetName) if not target then return "Player not found" end reason = reason or "No reason" -- Simple ban (use DataStore for persistence in real games) target:Kick("Banned by " .. admin.Name .. " for " .. (timeMin or "forever") .. " min: " .. reason) return target.Name .. " banned." end Commands.kill = function(admin, targetName) local target = findPlayer(targetName) or admin if target.Character and target.Character:FindFirstChild("Humanoid") then target.Character.Humanoid.Health = 0 return target.Name .. " killed." end return "No character found." end Commands.tp = function(admin, targetName1, targetName2) local p1 = findPlayer(targetName1) or admin local p2 = findPlayer(targetName2 or targetName1) if p1.Character and p2.Character and p2.Character:FindFirstChild("HumanoidRootPart") then p1.Character.HumanoidRootPart.CFrame = p2.Character.HumanoidRootPart.CFrame + Vector3.new(0, 3, 0) return p1.Name .. " teleported to " .. p2.Name end return "Failed to teleport." end Commands.speed = function(admin, targetName, speed) local target = findPlayer(targetName) or admin speed = tonumber(speed) or 16 if target.Character and target.Character:FindFirstChild("Humanoid") then target.Character.Humanoid.WalkSpeed = speed return target.Name .. " WalkSpeed set to " .. speed end return "Failed." end Commands.jump = function(admin, targetName, power) local target = findPlayer(targetName) or admin power = tonumber(power) or 50 if target.Character and target.Character:FindFirstChild("Humanoid") then target.Character.Humanoid.JumpPower = power return target.Name .. " JumpPower set to " .. power end return "Failed." end Commands.msg = function(admin, ...) local message = table.concat({...}, " ") for _, plr in ipairs(Players:GetPlayers()) do plr:SendNotification({Title = "Admin Message", Text = message, Duration = 10}) end return "Broadcast sent." end Commands.give = function(admin, targetName, toolName) -- Example: give a tool from ServerStorage or create one local target = findPlayer(targetName) or admin local tool = game.ServerStorage:FindFirstChild(toolName) or Instance.new("Tool") tool.Parent = target.Backpack return "Gave " .. toolName .. " to " .. target.Name end Commands.cmds = function(admin) local list = "Commands: kick, ban, kill, tp, speed, jump, msg, give, cmds" admin:SendNotification({Title = "Admin Commands", Text = list, Duration = 15}) return list end -- ======================= CHAT HANDLER ======================= Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(msg) if not msg:startsWith(PREFIX) then return end local args = msg:split(" ") local cmdName = args[1]:sub(#PREFIX + 1):lower() table.remove(args, 1) if not isAdmin(player) then player:SendNotification({Title = "Error", Text = "No permission."}) return end local commandFunc = Commands[cmdName] if commandFunc then local success, result = pcall(function() return commandFunc(player, unpack(args)) end) if success then print("[Admin Command] " .. player.Name .. " used " .. cmdName .. ": " .. (result or "Done")) else warn("Command error: " .. result) end else player:SendNotification({Title = "Unknown Command", Text = "Type " .. PREFIX .. "cmds"}) end end) end) print("Admin script loaded! Prefix: " .. PREFIX)