How to disable lower ranks from arresting higher ranks? (Teams)

So I’m making a cuff system, and I need to somehow detect if the person arresting rank is <= target’s rank, and what I mean by rank is just roblox Teams.

if things.Attack == "Arrest" then
		if not CharState and not TargetState then	
			ServerFunctions.SetCharState({Character = Character, State = "HasArrested", Duration = math.huge})
			ServerFunctions.SetCharState({Character = Target, State = "Arrested", Duration = math.huge})

			if TargetPlayer ~= nil then
				ClientEffects:FireClient(TargetPlayer, "BackpackToggle", {Phase = true, Player = TargetPlayer})
				EnemyHuman:UnequipTools()

			else
				EnemyHuman:UnequipTools()
			end
			weld(OriginRoot, TargetHumrp, CFrame.new(1.5,0,-3))
		end
		

This is not finished obviously, but im just tryna see how i would make a function checking priorities of teams, and by that disable / enable the person arresting the target.

One quick way that I can think of is to assign an IntValue to the character when they join the game. Then depending on what team they are, you change that value from 0 to 1, 2, etc.

When you then attempt to arrest some one, you compare the IntValue of the player arresting and the arrestee. If the arresting player is a lower value, you return, if the arresting player is a higher rank, you run the function.

1 Like