Why Am I Getting This Error?

I’ve been getting an error on a group scanner that I’ve been making. Currently, it is checking if a user is in any of the groups listed. If not, it takes action. But, in testing, whenever I changed the group my testing user is in that does not meet the requirement, I get a strange error that I cannot explain. Attached is my script and the error.

local TI = TweenInfo.new(3,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
local Tween1 = TS:Create(script.Parent.Scanner,TI,{["CFrame"] = CFrame.new(21.88, 0.938, 187.313)})
local Tween2 = TS:Create(script.Parent.Scanner,TI,{["CFrame"] = CFrame.new(21.88, 7.438, 187.313)})
local isActive = false
local touchedPlayers = {}


script.Parent.StartScan.Event:Connect(function()
	if isActive == false then
		isActive = true
		table.clear(touchedPlayers)
		script.Parent.Scanner.Transparency = 0
		Tween1:Play()
		wait(3)
		Tween2:Play()
		wait(3)
		Tween1:Play()
		wait(3)
		Tween2:Play()
		wait(3)
		script.Parent.Scanner.Transparency = 1
		for i, plr in pairs(touchedPlayers) do
			if not plr:IsInGroup(1022142) and not plr:IsInGroup(938043) and not plr:GetRankInGroup(157764) >= 110 then
				plr.Character.Humanoid:BreakJoints()
			end
		end
		table.clear(touchedPlayers)
		isActive = false
	end
end)

script.Parent.Scanner.Touched:Connect(function(hit)
	local h = hit.Parent:FindFirstChild("Humanoid")
	if h then
		local plr = game.Players:GetPlayerFromCharacter(h.Parent)
		if plr then
			table.insert(touchedPlayers,plr)
		end
	end
end)

Parenthesize it to:
if [...] not (plr:GetRankInGroup(157764) >= 110)
“not plr:GetRankInGroup(x)” will convert a number to boolean logic, as GetRankInGroup returns an integer value, and not int will evaluate false if the int exists, or true if the int is nil. Thus whatever the integer return of GetRankInGroup() gives you it will become false, and false >= 110 is your error.
An example of a similar comparation:
print(not 10 >= 5)false >= 5 → same error, number <= boolean
print(not (10 >= 5))not true → compiles, returns false as (10>=5) is true, and not true is false.

1 Like