I have a button and I want its text's size to tween when hovered over but it doesn't work. I guess it can't be used on an element's properties like that, so how would I do this?
1 | local Button = script.Parent |
2 |
3 | Button.MouseEnter:Connect( function () |
4 | Button.TextSize:TweenSize(UDim 2. new( 75 ), "Out" , "Quad" ) |
5 | end ) |
You need to use TweenService.
01 | local TweenService = game:GetService( 'TweenService' ) |
02 |
03 | local Button = script.Parent |
04 |
05 | Button.MouseEnter:Connect( function () |
06 | TweenService:Create(Button, TweenInfo.new( 1 , Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { TextSize = 75 } ):Play() |
07 | end ) |
08 |
09 | Button.MouseLeave:Connect( function () |
10 | TweenService:Create(Button, TweenInfo.new( 1 , Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { TextSize = 64 } ):Play() |
11 | end ) |
Hope this help, to more questions put bellow on commentaries.
If im not wrong you should just put in only the number, you don't need the UDim2.new()
1 | Button.TextSize:TweenSize(UDim 2. new( 0 , 75 ), "Out" , "Quad" ) -- you was changing offset not size |