Errors "attempt to compare number <= boolean" even when everything is numbers

print(groupID)
print(rankID)
print(player:GetRankInGroup(groupID))
local player = game.Players.LocalPlayer
if not player:GetRankInGroup(groupID) >= rankID then
  v:Destroy()
end

All of them printed numbers, why does it say boolean?

1 Like

Put brackets around ‘player:GetRankInGroup(groupID) >= rankID’
The ‘not’ keyword is converting the :GetRankInGroup() from a number to a boolean.

1 Like
print(groupID)
print(rankID)
print(player:GetRankInGroup(groupID))
local player = game.Players.LocalPlayer
if player:GetRankInGroup(groupID) >= rankID then
   
else
   v:Destroy()
end

When you add a not before player:GetRankInGroup(groupID), it converts into a boolean.

3 Likes

Ah thank you so much.
@NGC277 You too.

1 Like

No worries! Good luck developing!

1 Like