I’m making a module but it gives me some error that tells me that I am comparing a boolean >= number. My code:
local lerpAlpha = random:NextNumber(0, 0.9)
local lerpCFrame = point1.CFrame:Lerp(point2.CFrame, lerpAlpha)
if #tableOfLerps ~= 0 then
local lastNumTable = tableOfLerps[#tableOfLerps]
local lastnum = lastNumTable[2]
if lerpAlpha <= lastnum and (math.abs(lerpAlpha - lastnum) >= 0.2 or (math.abs(lastnum - lerpAlpha) >= 0.2)) then
repeat
lerpAlpha = random:NextNumber()
lerpCFrame = point1.CFrame:Lerp(point2.CFrame, lerpAlpha)
until not lerpAlpha <= lastnum and not (math.abs(lerpAlpha - lastnum) >= 0.2 or (math.abs(lastnum - lerpAlpha) >= 0.2)) --lerpAlpha <= lastnum seems to be the problem
end
local lastTable = {lerpCFrame, lerpAlpha}
table.insert(tableOfLerps, lastTable)
else
local lastTable = {lerpCFrame, lerpAlpha}
table.insert(tableOfLerps, lastTable)
end
I apologize for the messy indentation, for some reason the forum formats it like that when I paste it here
The following code gives the error, BUT if I add a print statement:
local lerpAlpha = random:NextNumber(0, 0.9)
print(lerpAlpha) --New print statement
local lerpCFrame = point1.CFrame:Lerp(point2.CFrame, lerpAlpha)
if #tableOfLerps ~= 0 then
local lastNumTable = tableOfLerps[#tableOfLerps]
local lastnum = lastNumTable[2]
if lerpAlpha <= lastnum and (math.abs(lerpAlpha - lastnum) >= 0.2 or (math.abs(lastnum - lerpAlpha) >= 0.2)) then
repeat
lerpAlpha = random:NextNumber()
lerpCFrame = point1.CFrame:Lerp(point2.CFrame, lerpAlpha)
until not lerpAlpha <= lastnum and not (math.abs(lerpAlpha - lastnum) >= 0.2 or (math.abs(lastnum - lerpAlpha) >= 0.2))
end
local lastTable = {lerpCFrame, lerpAlpha}
table.insert(tableOfLerps, lastTable)
else
local lastTable = {lerpCFrame, lerpAlpha}
table.insert(tableOfLerps, lastTable)
end
Then it suddenly works, but that’s when my next problem comes. Right now I need help with this. How can I make sure this works even without printing anything?