Hello!
I wanted to create a countdown UI like Game Rivals. To do this, I’m trying to tween TextLabel using Udim2, but if I use the code below to change the size, the text will move to the wrong place.
local TS = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Events = ReplicatedStorage:WaitForChild("Events")
local WaitTimeUpdate = Events:WaitForChild("WaitTimeUpdate")
local Intermission = script.Parent:WaitForChild("Intermission")
local TimerText = Intermission:WaitForChild("Timer")
local Glow = TimerText:FindFirstChild("Glow")
local TextTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Exponential)
local TextTweenProperty = {Size = UDim2.new(1,0,1,0)}
local TimerTextTween = TS:Create(TimerText, TextTweenInfo, TextTweenProperty)
local GlowTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine)
local GlowTweenProperty = {ImageTransparency = 1}
local GlowTween = TS:Create(Glow, GlowTweenInfo, GlowTweenProperty)
local function TextEffect()
TimerText.Size = UDim2.new(1.5,0,1.5,0)
TimerTextTween:Play()
Glow.ImageTransparency = 0.6
GlowTween:Play()
end
WaitTimeUpdate.OnClientEvent:Connect(function(timer)
TextEffect()
end)
To be honest, I haven’t fully understood the Ui concept like Udim2 yet. These elements were too difficult for a novice developer who wasn’t good at it.
I’ve read related documents, but it wasn’t easy to understand, maybe because it was inexperienced. Can you tell me how to use Udim2 to achieve what you want?