Invalid order function for sorting

I am trying to sort a table by lowest distance, and I get this error:


Invalid order function for sorting

this is the function:

	local function GetColliding(part: BasePart)
		local pos = part.Position
		local inRange = workspace:GetPartBoundsInRadius(pos,self.GrabRange)
		if #inRange > 0 then
			table.sort(inRange,function(a: Part,b:Part)
				return ((a.Position-pos).Magnitude <= (b.Position-pos).Magnitude)
			end)
			return inRange
		end
	end

nvm, I am blatantly dumb
it was the “=” in “<=”

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.