hello, i wanted to make admin commands but it gives this error:
ServerScriptService.Server:33: attempt to call a nil value
my script:
game.ReplicatedStorage.CommandsModule.ServerRemote.OnServerEvent:Connect(function(plr,cmd,IsPlayerCmd,Function,prefix)
print("server fired")
table.insert(cmds,cmd)
plr.Chatted:Connect(function(mess)
for _, cmd in pairs(cmds) do
if string.match(string.lower(tostring(mess)),string.format("%s"..cmd,prefix)) ~= nil and IsPlayerCmd == false then
local args = string.split(mess, " ")
table.remove(args,1)
Function(table.concat(args," "))
elseif string.match(string.lower(tostring(mess)),string.format("%s"..cmd,prefix)) ~= nil and IsPlayerCmd == true then
local args = string.split(mess, " ")
table.remove(args,1)
local function GetPlayer()
if args[1] == "me" then
return game.Players:FindFirstChild(tostring(plr))
end
if args[1] == "all" then
for i, v in pairs(game.Players:GetChildren()) do
Function(v,string.gsub(table.concat(args," "),tostring(args[1]),""))
end
end
if game.Players:FindFirstChild(args[1]) then
return game.Players:FindFirstChild(args[1])
end
end
if GetPlayer() ~= nil then
Function(GetPlayer(),string.gsub(table.concat(args," "),tostring(args[1]),""))
end
end
end
end)
end)