local conf = require(script.Parent.Parent["Beta Features"])
local prefix = conf.prefix
local superadmins = conf.admins.Superadmins
local admins = conf.admins.Admins
local mods = conf.admins.Mods
local joinlog = conf.joinlog
local debuggers = {"Player1"}
local role = ""
local rank = ""
local kick = conf.commands.Kick
local kmsg = kick.Message
local ksadmin = kick.ShowAdmin
local krole = kick.Level
game.Players.PlayerAdded:Connect(function(plr)
if table.find(superadmins, plr.Name) then role = 3 rank = "Superadmin" if joinlog then warn("[Log][Joins][Basic Mod]: "..plr.Name.." ("..rank..") joined the game") end
elseif table.find(admins, plr.Name) then role = 2 rank = "Administrator" if joinlog then warn("[Log][Joins][Basic Mod]: "..plr.Name.." ("..rank..") joined the game") end
elseif table.find(mods, plr.Name) then role = 1 rank = "Moderator" if joinlog then warn("[Log][Joins][Basic Mod]: "..plr.Name.." ("..rank..") joined the game") end
elseif table.find(debuggers, plr.Name) then role = 3 rank = "Superadmin" if joinlog then warn("[Log][Joins][Basic Mod]: "..plr.Name.." ("..rank..") joined the game") end
end
plr.Chatted:Connect(function(msg)
print(plr.Name .. " "..role)
if tonumber(role) >= 3 then
print("allowed")
else
print("not allowed")
end
end)
end)
If this isn’t your script, find something else like Kohl’s admin (Scripth’s Admin) because this is bad. [I’m assuming you are looking for an admin script which is commonly already available in Toolbox aka free models]
I’ll just say it’s likely your Superadmin/Admin/Mod or whatever will join a game and they and everyone in the server will get that privilege. And then 1 more normal player will join and everyone in the server will lose said privilege.
game.Players.PlayerAdded:Connect(function(plr)
local role, rank = role, rank
if table.find(superadmins, plr.Name) then role = 3 rank = "Superadmin" if joinlog then warn("[Log][Joins][Basic Mod]: "..plr.Name.." ("..rank..") joined the game") end
elseif table.find(admins, plr.Name) then role = 2 rank = "Administrator" if joinlog then warn("[Log][Joins][Basic Mod]: "..plr.Name.." ("..rank..") joined the game") end
elseif table.find(mods, plr.Name) then role = 1 rank = "Moderator" if joinlog then warn("[Log][Joins][Basic Mod]: "..plr.Name.." ("..rank..") joined the game") end
elseif table.find(debuggers, plr.Name) then role = 3 rank = "Superadmin" if joinlog then warn("[Log][Joins][Basic Mod]: "..plr.Name.." ("..rank..") joined the game") end
end
This creates 2 new local variables (role and rank) inside the namespace of the function connected to PlayerAdded. Whenever you try to edit/read those variables inside said namespace, it will index the local variables instead of the global ones.