Improving text grow and shrink effect

Ready:TweenSize(UDim2.new(0.75, 0, 0.55, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.25, true, function()
     Ready:TweenSize(UDim2.new(0.7, 0, 0.5, 0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.25, true)
end)

This is what I have currently, but it’s kinda clunky. Is there a cleaner (shorter) way to go about this?

1 Like
local function callback1(didCompleted)
   if didCompleted then
      Ready:TweenSize(UDim2.new(0.7, 0, 0.5, 0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.25, true)
   else
      print("The tween was cancelled, i think you made a misstake")
end

Ready:TweenSize(
   UDim2.fromScale(0.75, 0.55),
   Enum.EasingDirection.Out,
   Enum.EasingStyle.Linear,
   0.25,
   true,
   callback1
)
1 Like

That just makes it longer and more convoluted

1 Like

A good and readable script is always long and confusing at first glance, but so are good scripts. It is normal that it is long.

No, but a good script also should be keeping things as simple and readable as possible. My original code is more readable. No point being redundant and making things harder than it needs to be

Ready:TweenSize(UDim2.new(0.75, 0, 0.55, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.25, true, function() Ready:TweenSize(UDim2.new(0.7, 0, 0.5, 0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.25, true) end)

This is what ur code look like

It may seem simpler, but it is totally not readable. Maybe try a few spaces like Eternallove did

Useless Info

Also he misspelled ‘misstake’

1 Like

you can use uiconstraints such as UIAspectRatio. THen just set the value to higher to be bigger and lower to be smaller

1 Like

Have you tried using actual TweenService?

You can use TweenService for this. The TweenInfo has a “reverses” parameter, which will play the tween forward and reverse in the same easing types. Make sure to also set the “repeatCount” parameter to -1 (infinite repetition until cancelled or paused). It is not recommended to set it to very large numbers, as cited on the Developer Wiki:

Developers should avoid using large numbers (or math.huge) as a substitute as this is unstable and may stop working at any point.

local TweenService = game:GetService("TweenService")
local ReadyText = Your.Path.To.Text
local GSTweenInfo = TweenInfo.new(0.25, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1, true)
--// if you want it to be stopped/played throughout a function, make it a local and call the :play() function on the next line
local GrowShrinkTween = TweenService:Create(ReadyText, GSTweenInfo, {Size = UDim2.new(0.75, 0, 0.55, 0)})
GrowShrinkTween:Play()
2 Likes

It’s :ok_hand: in my opinion. Shorter than people who are trying to simplify it for you, so just go with it.

@NinjoOnline, i’m not saying it to be angry, but i think you should move the topic into the #help-and-feedback:code-review because here you already have your script and don’t ask for a feedback.

1 Like