Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Attempt to compare number and boolean?

My code (this is only some of it)

WallSizeText.FocusLost:Connect(function(enterPressed, inputThatCausedFocusLost)
		if enterPressed then
			local Size = tonumber(WallSizeText.Text)
			
			if not Size >= 100 then
				game.ReplicatedStorage.ObjSize:FireServer(Size, game.ReplicatedStorage.PlacementItems.Wall)
			else
				WallSizeAsker.Text = "Limt is 100!"
				wait(3)
				WallSizeAsker.Text = "How big would you like your wall to be?"
			end
		end
	end)

I put 50 in the text box and I got this error: attempt to compare number and boolean I used tonumber but I don't know if I'm using it right.

1 answer

✓ Accepted answer

I tested out your script and changed up some things to find the problem and fix it. I knew the problem was on line 5 because of what the output said. The problem is your not. I guess Lua will not allow you to use a boolean when you're comparing numbers like this. Just make it simple and use < instead of making it complicated by using not Size >=.

Line 5

if Size < 100 then

1 comment

0

Thanks.

This discussion is preserved as it was. New answers, comments, and votes are closed.