Here is full code of Commands module, everywhere where for loop looks for players this issue happens:
local Fly = workspace.RemoteEvents.Console.Functions.Fly
local teleportService = game:GetService("TeleportService")
local permissionIndex = {
["root"] = 5,
["hadmin"] = 4,
["admin"] = 3,
["mod"] = 2,
["user"] = 1
}
return {
["rejoin"] = {["Callback"] = function(executor)
teleportService:Teleport(game.PlaceId, executor)
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
Console:Output(ConsoleUI, "Rejoining...")
end,
["Permission"] = 1},
["reload"] = {["Callback"] = function(executor)
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
Console:Update(ConsoleUI, false)
end,
["Permission"] = 1},
["info"] = {["Callback"] = function(executor, args)
local Players = game:GetService("Players"):GetPlayers()
for _,player in pairs(game:GetService("Players"):GetChildren()) do
if string.match(player.Name:lower(), "^"..table.remove(args, 1):lower()) then
local target = player
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
Console:PlayerInformation(target, ConsoleUI)
else
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
Console:Output(ConsoleUI, "This player doesn't exists!")
end
end
end,
["Permission"] = 2},
["pex"] = {["Callback"] = function(executor, args)
local PlayerManager = require(game:GetService("ServerScriptService").PlayerManager)
for _,player in pairs(game:GetService("Players"):GetChildren()) do
print(player.Name:lower(), table.remove(args, 1):lower())
if string.match(player.Name:lower(), "^"..table.remove(args, 1):lower()) then
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
local target = player
local permGroup = table.remove(args, 1)
local executorGroup = PlayerManager.GetValue(executor, "PermissionGroup")
local targetGroup = PlayerManager.GetValue(target, "PermissionGroup")
local executorIndex = permissionIndex[executorGroup]
local targetIndex = permissionIndex[targetGroup]
if executorIndex > targetIndex then
PlayerManager.SetValue(target, "PermissionGroup", permGroup:lower())
Console:Output(ConsoleUI, "You successfully updated "..target.Name.." Permission Group to "..permGroup)
else
Console:Output(ConsoleUI, "You don't have enough permissions to update "..target.Name.." Permission Group!")
end
else
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
Console:Output(ConsoleUI, "This player doesn't exists!")
continue
end
end
end,
["Permission"] = 4},
["fly"] = {["Callback"] = function(executor)
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
local char = executor.Character
local Configs = char.Configs
local CanFly = Configs.CanFly
local PlayerManager = require(game:GetService("ServerScriptService").PlayerManager)
if CanFly.Value == false then
Fly:FireClient(executor, "enable")
CanFly.Value = true
Console:Output(ConsoleUI, "Flying has successfully been enabled.")
else
Fly:FireClient(executor, "disable")
CanFly.Value = false
Console:Output(ConsoleUI, "Flying has successfully been disabled.")
end
end,
["Permission"] = 3},
["bring"] = {["Callback"] = function(executor, args)
for _,player in pairs(game:GetService("Players"):GetChildren()) do
if string.match(player.Name:lower(), "^"..table.remove(args, 1):lower()) then
local target = player
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
local executorChar = executor.Character
local targetChar = target.Character
local executorRoot = executorChar.HumanoidRootPart
local targetRoot = targetChar.HumanoidRootPart
targetRoot.Position = executorRoot.Position
Console:Output(ConsoleUI, "You successfully been teleported "..target.Name.." to your position")
else
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
Console:Output(ConsoleUI, "This player doesn't exists!")
continue
end
end
end,
["Permission"] = 2},
["to"] = {["Callback"] = function(executor, args)
for _,player in pairs(game:GetService("Players"):GetChildren()) do
if string.match(player.Name:lower(), "^"..table.remove(args, 1):lower()) then
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
local target = player
local executorChar = executor.Character
local targetChar = target.Character
local executorRoot = executorChar.HumanoidRootPart
local targetRoot = targetChar.HumanoidRootPart
executorRoot.Position = targetRoot.Position
Console:Output(ConsoleUI, "You successfully been teleported to "..target.Name.." position")
else
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
Console:Output(ConsoleUI, "This player doesn't exists!")
continue
end
end
end,
["Permission"] = 2},
["tp"] = {["Callback"] = function(executor, args)
local goalX = table.remove(args, 1)
local goalY = table.remove(args, 1)
local goalZ = table.remove(args, 1)
if game:GetService("Players"):FindFirstChild(executor.Name) then
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
local executorChar = executor.Character
local executorRoot = executorChar.HumanoidRootPart
executorRoot.Position = Vector3.new(goalX, goalY, goalZ)
Console:Output(ConsoleUI, "You successfully been teleported to entered coordinates")
end
end,
["Permission"] = 2},
["kick"] = {["Callback"] = function(executor, args)
local PlayerManager = require(game:GetService("ServerScriptService").PlayerManager)
for _,player in pairs(game:GetService("Players"):GetChildren()) do
if string.match(player.Name:lower(), "^"..table.remove(args, 1):lower()) then
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
local target = player
local reason = table.remove(args, 1)
if reason == nil or "" then
reason = "You have been kicked by "..executor.Name
end
local executorGroup = PlayerManager.GetValue(executor, "PermissionGroup")
local targetGroup = PlayerManager.GetValue(target, "PermissionGroup")
local executorIndex = permissionIndex[executorGroup]
local targetIndex = permissionIndex[targetGroup]
if executorIndex > targetIndex then
target:Kick(reason)
Console:Output(ConsoleUI, "You successfully kicked "..target.Name.."\nPlease note if you kicked player without any reason, you will get warning(as of AA rule)")
else
Console:Output(ConsoleUI, "You don't have enough permissions to kick "..target.Name.."!")
end
else
local Console = require(script.Parent)
local ConsoleUI = executor.PlayerGui.DevConsoleGui
Console:Output(ConsoleUI, "This player doesn't exists!")
continue
end
end
end,
["Permission"] = 2},
--[[["noflood"] = {["Callback"] = function(executor, args)
local flood = game.Workspace.ServerStorage.EventStuff.Water
flood:Destroy()
end,
["Permission"] = 2}--]]
}