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

It keeps giving me a output that shows this in a while true do loop and idk what to do?

So im trying to make a loop in a part that if the position of the part is not at 500 it will continue adding on to the force but it keeps showing me a error saying part = script.Parent 23:13:54.809 - Workspace.Part.Script:7: bad argument #2 to '?' (Vector3 expected, got number)

part = script.Parent

Bdforce = part.BodyForce


while true do 
Bdforce.Force = Bdforce.Force + 1
wait()
if part.Position.Y == 500 then
	break
	
end
end

1 answer

Because you're attempting to add a number to a Vector3. You should also know that whenever you're comparing the coordinates to a number, you should round the coordinates because even if it is at 500, it won't stop due to float precision.


part = script.Parent

Bdforce = part.BodyForce


while true do 
Bdforce.Force = Bdforce.Force + Vector3.new(0, 1, 0)
wait()
if math.floor(part.Position.Y) == 500 then
    break

end
end

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