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 make a part gradually extend to spread to another point?

If I were to have a part at 0,0,0 and I want to make it get to 0,0,10 each time by 1, that bit is easy, I would just:

Make a new part, at 0,0,0

for loop adding 1 length to the z axis and putting position across by 0.5 per iteration, possibly with a Wait()

Yet how would I do it for unspecified locations, that are dynamic; dependent on the user, specifically if I wanted the start position to be at the end of the user's right arm, which I know how to do (roughly)

Start = CFrame.new(game.Workspace.Player["Right Arm"].Position +vector3(0,1,0))

But how can I make the part span across, by only extending on the Z axis.

So if the arm was at 0,0,0 and the target was at 0,10,0, then how do I rotate the part (in this instance) perpendicular to the direction of travel so it only extends on the z axis. Thank you.

1 answer

You are doing the CFrame wrong. CFrame has two parameters:

  • Position (which you already have)
  • LookVector (where the part is facing)

LookVector is a Vector3 value, so you can make it look anywhere. The only problem with this is that you will have to:

A) Mess around with the LookVector value to align it with the Z axis instead.

B) Use the X axis instead of Z, which is easier.

I do not know how to do A, but B is simple:

Start = CFrame.new(game.Workspace.Player["Right Arm"].Position +vector3(1,0,0),ame.Workspace.Player["Right Arm"].Position +vector3(11,0,0)) -- add 1 to it, because CFrame is glitchy when it's looking at itself

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