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

How do i move a part from right to left?

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?

2 comments

0

SOmeone Please Help me.

0

You need to set w to the BodyVelocity and change w.Velocity

1 answer

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.

1 comment

0

Thnks

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