Tween Size In Only One Direction

You can write your topic however you want, but you need to answer these questions:

  1. What I want to achieve?

I would like to Tween a part almost like a lightsaber, so the laser slowly comes out.

  1. What is the issue? Include screenshots / videos if possible!

When I Tween the size it Tweens it in both directions instead of only going in one.

  1. What solutions have I tried so far? Did you look for solutions on the Developer Hub?

I have tried using the X,Y,Z Vector’s seperatley and then just add to it but it won’t work.

My script

local TweenService = game:GetService("TweenService")



local tweenInfo = TweenInfo.new(
	1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local LaserOn = 
{
	Size = Vector3.new(24, 1, 1)
}

local TurnLaserOn = TweenService:Create(script.Parent, tweenInfo, LaserOn)

wait(5)

TurnLaserOn:Play()
1 Like

I believe you’ll also need to Tween the Position property as well, depending on which direction you want it to tween?

local TweenService = game:GetService("TweenService")



local tweenInfo = TweenInfo.new(
	1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local LaserOn = 
{
	Size = Vector3.new(24, 1, 1)
    Position = Vector3.new(script.Parent.CFrame.X + 24, script.Parent.CFrame.Y, script.Parent.CFrame.Z)
}

local TurnLaserOn = TweenService:Create(script.Parent, tweenInfo, LaserOn)

wait(5)

TurnLaserOn:Play()

Here’s a cool illustration on how it works:

2 Likes

Thank you, I thought I was doing something wrong turns out I just have to do an extra step.

1 Like