I have created a simple Ban & Kick system for my game. The problem is that this admin will be given to multiple ranks, and without some security the lower ranks can kick higher ranks which is what I want to stop. My attempt has failed and I am unsure on how to do this.
script.Parent.MouseButton1Click:Connect(function(Player)
local SupposedName = script.Parent.Parent.TextBox.Text
if game.Players:FindFirstChild(SupposedName) and SupposedName:GetRankInGroup(1052008) > game.Players.LocalPlayer:GetRankInGroup(1052008) then
else
if game.Players:FindFirstChild(SupposedName) and game.Players.LocalPlayer:GetRankInGroup(1052008) >= 252 then
local PlayerNa = game.Players:FindFirstChild(SupposedName)
script.Parent.Ban:FireServer(PlayerNa)
end
end
end)
You could hardcode it to where certain ranks have an assigned integer based on how important they are. Have everyone else have the integer 0 by default. A low-level admin could have integer 1 and a medium one integer 2, etc.
Make it to where when an admin attempts to ban someone, it will only work if that person’s assigned integer is less than theirs. That way, admins can’t ban their fellow rank or anyone above their rank
Appears your trying to ban user X if local users rank is higher OR if local uses rank >= 252. Here is a script that does exactly that
script.Parent.MouseButton1Click:Connect(function(Player)
local TargetPlayer = game.Players:FindFirstChild(script.Parent.Parent.TextBox.Text)
if TargetPlayer and TargetPlayer:GetRankInGroup(1052008) < game.Players.LocalPlayer:GetRankInGroup(1052008) or TargetPlayer and game.Players.LocalPlayer:GetRankInGroup(1052008) >= 252 then
script.Parent.Ban:FireServer(TargetPlayer)
end
end)