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

How to apply math to vector3.new?

Instead of having a brick move like

wait(.1)
part.Position = Vector3.new(x, x, x)
wait(.1)
part.Position = Vector3.new(x, x, x)
wait(.1)
part.Position = Vector3.new(x, x, x)
wait(.1)
part.Position = Vector3.new(x, x, x)
wait(.1)
part.Position = Vector3.new(x, x, x)
wait(.1)
part.Position = Vector3.new(x, x, x)
wait(.1)
part.Position = Vector3.new(x, x, x)
wait(.1)
part.Position = Vector3.new(x, x, x)
wait(.1)
part.Position = Vector3.new(x, x, x)
wait(.1)
part.Position = Vector3.new(x, x, x)

and so on. How would I shorten this and make it do with math. Like change the x value by .1 using math? So like "while true do wait(.01) part.Position = Vector3.new(x[+1], x, x) wait(.01) or something like that. Please help.

1 answer

while true do 
wait(0.1)
script.Parent.Position=script.Parent.Position+Vector3.new(0,0,.1)

Or if you want it to be able to move through things

while true do 
wait(0.1)
script.Parent.Position=script.Parent.Position+CFrame.new(0,0,.1)

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