Tween only X property

  1. What do you want to achieve?
    I want to tween an object Size Axis
    independently of others axis (For example : Tweening size X to 5 in 0.5s while tweening size Y to 2 in 1s).

Is there a way to accomplish this ?

yes, but its quite complicated for no reason :smile:

basically you must use separate Value objects. create NumberValues for each axis and tween them independently, then update the object’s Size!

heres your answer for your example

local TweenService = game:GetService("TweenService")

local part = workspace.Part

local xValue = Instance.new("NumberValue")
local yValue = Instance.new("NumberValue")
local zValue = Instance.new("NumberValue")

xValue.Value = part.Size.X
yValue.Value = part.Size.Y
zValue.Value = part.Size.Z

local function updateSize()
	part.Size = Vector3.new(xValue.Value, yValue.Value, zValue.Value)
end

xValue.Changed:Connect(updateSize)
yValue.Changed:Connect(updateSize)
zValue.Changed:Connect(updateSize)

--tween x to 5 in 0.5s
local tweenX = TweenService:Create(
	xValue,
	TweenInfo.new(0.5),
	{Value = 5}
)

--tween y to 2 in 1s
local tweenY = TweenService:Create(
	yValue,
	TweenInfo.new(1),
	{Value = 2}
)

tweenX:Play()
tweenY:Play()
1 Like

Hmm I see. Thanks you, this was helpful :grin:

glad to help :smile: :smile: ​​​​​​​​​​​​​​​​​​​​​

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