Even though PrivilegeLevel is set to 10, Roblox thinks it's >= 240?

Hello,

I’m trying to make a PrivilegeLevel system with my leaderboard, where you can set a player as a rank. However, when a player’s PrivilegeLevel is set to 10, Roblox thinks that it’s bigger or equal to 240 and bigger than 255. I’ve used Print Debugging to figure this out, as the print statement says:

LocalPlayer PL: 10, SelectedPlayer PL: 255
showPrivilegeDropdown is true because 10 >= 240 and 10 > 255.

Here’s my code:

if IsPrivilegeLevelEnabled or userId == 129415482 and localPlayerPL >= privilegeLevel.adminLevel and localPlayerPL > selectedPlayerPL then
	showPrivilegeDropdown = true
			
	print("showPrivilegeDropdown is "..tostring(showPrivilegeDropdown).." because "..tostring(localPlayerPL).." >= "..tostring(privilegeLevel.adminLevel).." and "..tostring(localPlayerPL).." > "..tostring(selectedPlayerPL)..".")
else
	showPrivilegeDropdown = false
end

Thanks!

This seems to be a precedence issue, try:

if (IsPrivilegeLevelEnabled or userId == 129415482) and localPlayerPL >= privilegeLevel.adminLevel and localPlayerPL > selectedPlayerPL then

Currently what you’re doing is:

if IsPrivilegeLevelEnabled or (userId == 129415482 and localPlayerPL >= privilegeLevel.adminLevel and localPlayerPL > selectedPlayerPL) then

if isPrivilegeLevelEnabled is true then the statement will always be true.

3 Likes