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

How do i move a part from right to left?

Asked by 8 years ago

I need help by moving a "Part" from right to left using BodyVelocity here is the Script i done:

while true do

w=game.Workspace.Part.BodyVelocity.Velocity

w=Vector3.new(10*0*0)

            wait(2)

w=Vector3.new(-10*0*0)

            wait(1)

end

How do i move the part from right to left using BodyVelocity?

0
SOmeone Please Help me. nowrs123 0 — 8y
0
You need to set w to the BodyVelocity and change w.Velocity User#6546 35 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Properties

When you set a variable to a property, you set it to the value for the property - Not the actual property. This means that when you change the variable again, you're only changing the value of the variable and not the value of the property.

while true do
    w=game.Workspace.Part.BodyVelocity
    w.Velocity=Vector3.new(10*0*0)
    wait(2)
    w.Velocity=Vector3.new(-10*0*0)
    wait(1)
end

The solution is to set the Velocity every time.

0
Thnks nowrs123 0 — 8y
Ad

Answer this question