I add people on admin commands and when i test it its not working heres the image line Can somebody help me about it i want to add one more people using that command thanks!
It’s better if you copy and paste it here using ``` on top and and bottom.
For example:
local a = game.Players.LocalPlayer
If a then
print("hi")
end)
Add ```
on the top and at the bottom
local playersService = game:GetService(“Players”)
return function(str, plr)
if str == “me” then return {plr}
elseif str == “all” then return playersService:GetPlayers()
elseif str == “others” then
local others = {}
for _,player in pairs(playersService:GetPlayers()) do
if player.UserId ~= plr.UserId then table.insert(others, player) end
end
return others
elseif str == “random” then return {playersService:GetPlayers()[math.random(#playersService:GetPlayers())]}
else
for _,player in pairs(playersService:GetPlayers()) do
if player.Name:lower() == str:lower() then return {player} end
end
for _,player in pairs(playersService:GetPlayers()) do
if player.Name:lower():sub(1, #str) == str then return {player} end
end
end
end
not that
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local ServerStorage = game:GetService(“ServerStorage”)
local Players = game:GetService(“Players”)
local commands = ServerStorage.AdminCommands
– Settings
local Admins = {“DylTheDeveloperX” ,“F0LL9WERS”}
local prefix = “/” – Change this to the starting character
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(message)
if not table.find(Admins, Player.Name) then return end
if message:sub(1, #prefix) ~= prefix then return end
local args = message:split(" ")
local cmd = args[1]:sub(#prefix + 1, #args[1]):lower()
table.remove(args, 1)
if not commands:FindFirstChild(cmd) then return end
spawn(function()
require(commands[cmd]).run(Player, message, args)
end)
end)
end)
my issue is on line 7 when i try to test it its not allowed to use the command
Does it give you any warning or error upon attempting to run the command?
there is no warning … but i can still use the admin but for f0llo9wers he cant use it.