Tweens not working

Hello, my code is working only for 1 button, and not other buttons. The code should work for all buttons. because it uses script.parent for declaring the button.

I’m trying to make the button longer in height when hover over.

I got nothing in output, so I don’t know where the problem is.

local tweens = game:GetService("TweenService")

local btn = script.Parent

local tweenInfo = TweenInfo.new(
	.25,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false,
	0
)

local tween = tweens:Create(btn, tweenInfo, {Size = UDim2.new(0, 512, 0, 286)})
local tween2 = tweens:Create(btn, tweenInfo, {Size = UDim2.new(0, 512, 0, 256)})



script.Parent.MouseEnter:Connect(function()
	tween:Play()
end)

script.Parent.MouseLeave:Connect(function()
	tween2:Play()
end)```

Thanks.
1 Like

Why dont you just use TweenSize?

btn:TweenSize(UDim2.new(whatever here), EasingDirection, Easing Style, Delay, Reversed? TimesRepeated

When adding your Easing stuff,you do "Sine", not
Enum.EasingStyle.Sine

It does it without a Play function

1 Like

Thanks! The problem was because the buttons childs were interfiering with the size.