RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make me admin only chat commands"
To create admin-only chat commands, you first need to define a list of admins and then check if the player sending the message is an admin before executing the command. Here's a server script for that: ```lua local admins = {"YourUsername", "AnotherAdminUsername"} local function isAdmin(player) for _, admin in ipairs(admins) do if player.Name == admin then return true end end return false end local function onChat(player, message) if isAdmin(player) then if message == "!killall" then for _, plr in ipairs(game.Players:GetPlayers()) do if plr.Character then plr.Character:BreakJoints() end end elseif message == "!healall" then for _, plr in ipairs(game.Players:GetPlayers()) do if plr.Character and plr.Character:FindFirstChild("Humanoid") then plr.Character.Humanoid.Health = plr.Character.Humanoid.MaxHealth end end end end end game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(message) onChat(player, message) end) end) ``` Replace "YourUsername" and "AnotherAdminUsername" with the usernames of the admins you want to have access to the chat commands. You can add more commands by adding more `elseif` statements. In this example, there are two commands: `!killall` and `!healall`.