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

How can I make a part move without a rotating brick or BodyPosition?

Asked by 7 years ago

What I'm trying to do, is that when brickA gets clicked, brickB will move 5 studs away.

I know how to do the Clicking part using click detection and such.

The problem is that How can I move brickB and modelB together just by having a command that only moves brickB?

brickB and ModelB is welded.

1 answer

Log in to vote
0
Answered by 7 years ago

Well, there are multiple ways to do this, two of which come to mind (using the physics engine or using a CFrame). However, because you do not want to use the physics engine (BodyPosition), I am going to focus on the CFrame aspect of this.

Now, I'm going to leave a few paths depending on some conditions not given:

--partA is NOT in modelB and partA is NOT welded to modedB move part b via "partB.CFrame = partB.CFrame * CFrame.new(0,0,-5)" this will make the brick fall 5 studs backwards (along its z axis), but the main idea is that CFrames are nice to welds and will carry them (this is why they are used to move players around in teleport scripts) --partA IS in modelB AND IS welded to modelB this means that the offset (C0 or C1, depending on how you are doing things, but most likely C1) of weld between partB and its welded part will need to change for example, "weld_parent.Weld.C0 = weld_parent.Weld.C0 * CFrame.new(0,0,-5)" (note: weld_parent can be partb, I just do not have more information to narrow my description).

CFrames can be troublesome and confusing for those unaware of their design, so I also suggest reading up on them on the roblox wiki.

Ad

Answer this question