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

How to Tween MouseEnter TextSize?

I get error at the "TextSize = 100" How can I tween the textsize of the GUI Button?

script.Parent.MouseEnter:Connect(function()
	local TweenService = game:GetService("TweenService")
	local tweenInf = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
	local Properties = {(TextSize = script.Parent.TextSize = 100)}
	TweenService:Create(script.Parent.TextSize, tweenInf, Properties):Play()
end)

1 answer

✓ Accepted answer

Sorry for modifying your code so much. You see, "Properties" and "TweenService:Create" has to do with the problem. You don't define what object you're changing, you're just changing what the properties are if you are using TweenService.

For example, if you wanted to change the color of a part, it would just be

local Properties = {Color3.new(0,0,0)} --whatever color you would like it to be

also when you use TweenService:Create, the first one is defining what the parent is. So for the same color example, it would be

TweenService:Create(workspace.Part, tweenInf, Properties)

I respect that you tried, so I whipped up this code for you. Once again, sorry for changing it so much. Just put this in a local script inside of the TextButton.

local TextButton = script.Parent
local TweenService = game:GetService("TweenService")
local TweenInfoA = TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.In, 0, false, 0)
local Properties = {TextSize = 100}

local Tween = TweenService:Create(TextButton,TweenInfoA,Properties)

TextButton.MouseEnter:Connect(function()
	Tween:Play()
end)

TextButton.MouseLeave:Connect(function()
	Tween:Cancel()
	TextButton.TextSize = 50 --Original Text Button Size
end)

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