Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make this script tween the button's text size?

Asked by 4 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

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?

1local Button = script.Parent
2 
3Button.MouseEnter:Connect(function()
4    Button.TextSize:TweenSize(UDim2.new(75),"Out","Quad")
5end)

3 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

You need to use TweenService.

01local TweenService = game:GetService('TweenService')
02 
03local Button = script.Parent
04 
05Button.MouseEnter:Connect(function()
06    TweenService:Create(Button, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextSize = 75}):Play()
07end)
08 
09Button.MouseLeave:Connect(function()
10    TweenService:Create(Button, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextSize = 64}):Play()
11end)

Hope this help, to more questions put bellow on commentaries.

Ad
Log in to vote
1
Answered by 4 years ago

If im not wrong you should just put in only the number, you don't need the UDim2.new()

0
You're right. TextSize is a number value, not a Udim2 value LeedleLeeRocket 1257 — 4y
Log in to vote
0
Answered by 4 years ago
1Button.TextSize:TweenSize(UDim2.new(0, 75),"Out","Quad") -- you was changing offset not size
0
You can't use TweenSize with TextSize because TweenSize is a Method and TextSize is a ValueType. NiniBlackJackQc 1562 — 4y

Answer this question