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

Part is not moving upward when it is supposed to. Why is this?

Asked by 5 years ago
brick = game.Workspace.Part

while true do
    wait(5)
    brick.Position = brick.Position - Vector3.new(0, 50, 50)
end

For some reason, the code above is just making the part disappear after five seconds.

(Don't laugh, please. I am new to scripting.)

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

I don't believe the part is disappearing, it's just moving to a new location and since it's 50 studs down and 50 studs in the Z axis you don't know where it is.

To make it move upwards instead of down change brick.Position = brick.Position - Vector3.new(0, 50, 50) to brick.Position = brick.Position + Vector3.new(0, 50, 50)

The reason behind it getting down (which gives it the illusion of disappearing) is that you are subtracting from the position by 50 studs, making it go under the baseplate.

To fix this, just make the "-" into a "+".

brick = game.Workspace.Part

while true do
    wait(5)
    brick.Position = brick.Position + Vector3.new(0, 50, 50) -- the brick will move 50 studs up and 50 studs away
end
Ad

Answer this question