How do i make a part increase length in 1 direction

Using scripts i want the cylinder to tween increase size from the mouth of the blaster, i already used a tween size increase but it would increase both ways, moving the part ahead then using the tween wouldn’t make it seem like the lazer will increase from the blaster head, instead it would increase from far ahead both ways

image

I think you have to increase the size and the position at the same time.

I think its a matter of direction and increasing size.

local direction = -- The direction that the blaster is facing (CFrame.LookVector)
local size = -- The amount of increase that you want (a number)

local cylinder = -- the cylinder thing
cylinder.Position = direction * (size / 2)
cylinder.Size = cylinder.Size + (0, 0, size)
--                               /\ /\ /\
-- You can change which component of this vector is being changed

2 Likes

1 small issue
image
they only appear in 1 area

You can manipulate the cylinder’s CFrame. With CFrame, you can adjust the position and rotation in a more complex way. You can use either of these while normally resizing your cylinder, depending on how you want the effect to act:

 -- Moves the cylinder one stud forward locally.
<Your Part Effect>.CFrame *= CFrame.new(0, 0, 1)

 -- Moves the cylinder one stud forwards globally.
<Your Part Effect>.CFrame = CFrame.new(0, 0, 1) * <Your Part Effect>.CFrame

You can try rotating the LookVector with CFrame.Angles. Since the LookVector is the “front” of a part and, in this case, the cylinder is rotated, making the LookVector be in a different direction.

You can try fidgeting with the CFrame like this:

direction = direction * CFrame.Angles(math.rad(90), 0, 0)
1 Like