Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I fix the "attempt to compare boolean with number" problem?

Asked by 3 years ago

local bodyVelocity = script.Parent.BodyVelocity local bodyPosition = script.Parent.BodyPosition while true do if 280 < (part.Position - part2.Position).magnitude < 300 then bodyVelocity.Velocity = Vector3.new(0,0,0) bodyPosition.Position = game.Players.tuanorn.Character.HumanoidRootPart.Position bodyPosition.MaxForce = Vector3.new(4000,4000,4000) end wait() end

The part doesn't return to my character's HumanoidRootPart. The output said: "attempt to compare boolean and number". How can I fix this?

1 answer

Log in to vote
0
Answered by 3 years ago

Try changing line 4 to:

if (part.Position - part2.Position).magnitude > 280 and (part.Position - part2.Position).magnitude < 300 then
Ad

Answer this question