Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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?

local Button = script.Parent

Button.MouseEnter:Connect(function()
	Button.TextSize:TweenSize(UDim2.new(75),"Out","Quad")
end)

3 answers

✓ Accepted answer

You need to use TweenService.

local TweenService = game:GetService('TweenService')

local Button = script.Parent

Button.MouseEnter:Connect(function()
	TweenService:Create(Button, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextSize = 75}):Play()
end)

Button.MouseLeave:Connect(function()
	TweenService:Create(Button, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {TextSize = 64}):Play()
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 comment

0

You're right. TextSize is a number value, not a Udim2 value

Button.TextSize:TweenSize(UDim2.new(0, 75),"Out","Quad") -- you was changing offset not size

1 comment

0

You can't use TweenSize with TextSize because TweenSize is a Method and TextSize is a ValueType.

This discussion is preserved as it was. New answers, comments, and votes are closed.