Tween part size to right

Hello I have an issue on tweening a part size, when I tween the size bigger it gets bigger in both sides, and I want it to tween size only to the right

Scripts I tried

local lights_on = TweenService:Create(light, TweenInfo.new(3), {Size = Vector3.new(20.5, light.Size.Y, light.Size.Z)})

This requires simultaneous movement in the opposite direction. So each step to the right means half a step to the left.

To achieve this, we have to know the difference between the original an new size, then divided by two:

For instance (lerp actually):

newSizeX = 10
oldSizeX = 2
change = 10 - 2 = 8
moveByX = 8/2 = 4 (negative for left)

Same applies to both other axis.

local tween = TweenService:Create(light, TweenInfo.new(3), {
	Size = Vector3.new(20.5, light.Size.Y, light.Size.Z),
	CFrame = light.CFrame * CFrame.new(-(20.5 - light.Size.X)*.5, 0, 0)
})
1 Like

what if I want it to tween to the left

Change the position travel towards the positive.

X: left (+), right (-)
Y: upwards (+), downwards (-)
Z: forward (-), backwards (+)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.