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

How to move a brick along custom path and without wait()?

Asked by
Ribasu 127
5 years ago
Edited 5 years ago

Let's say I have two parts in my game world: A and B at some position.

A.Position = Vector3.new(10, 0,10)
B.Position = Vector3.new(-10  , 0,  -10)

I also have another part, myPart at some position:

myPart.Position = Vector3.new(0,0,0)

I want myPartto move from A to B and B to A and A to B and so on and so forth... but I have some restrictions:

(a) do not use wait(). Under heavy load, wait()does not wait as much as intended. e.g. wait(0.1) can sometimes end up waiting 0.15 or worse, leading to quite unpredictable behaviour, so I do not want to use it.

(b) use a custom path rather than a straight line path: I want to go from A to B and B to A by having myPartmove in a very simple zigzag motion while getting to its target.

How do I move myPart from A to B and back (B to A) over and over again without using a wait()and using a custom path? Maybe lerping or using physics bodymovers might be the answer. But I am not familiar with them enough to provide the desired behaviour. Could you please guide me forward as the wiki is not helpful.

0
How can I use tween to have a custom path motion e.g. zigzag path? As far as I know, tween only lets you go from A to B in a straight line. Ribasu 127 — 5y
0
tween info. greatneil80 2647 — 5y
0
if you don't like straight lines, try use the lerp function of cframe to create a bezier curve theking48989987 2147 — 5y
0
Could you please give me some more detail on how I would use lerp as in your suggestion and in light of my requirement (a)? Ribasu 127 — 5y

Answer this question