I am trying to tween a UDim. From 0.125,0 to 1,0 . Does anyone know how I would go about this? (It is on a UICorner.)
I’d recommend the TweenService. Here is some code:
local TweenService = game:GetService("TweenService")
local uiCorner --set to a ui corner
local goal = {CornerRadius = UDim.new(1,0)}
local tweenInfo = TweenInfo.new()
local tween = TweenService:Create(uiCorner, tweenInfo, goal)
tween:Play()
--tween.Completed:Wait() --the event that fires when the tween finishes and a Wait call on it
I'd recommend checking out these articles for more information:
To tween a UDim property on an Instance, you would use TweenService’s Create function.
This will return a Tween object, to which you can then call the Play function on it, just like you would with a Sound.
Here’s an example:
local TweenService = game:GetService("TweenService")
local Tween = TweenService:Create(
UICorner, -- Instance
TweenInfo.new(1), -- TweenInfo object.
{CornerRadius = UDim.new(1, 0)} -- Properties dictionary.
)
Tween:Play()
3 Likes
Simple:
local ui = script.Parent -- UI Here, Make sure to adjust
ui:TweenPosition(
UDim2.new(1, 0, 1, 0); -- Position Here
Enum.EasingDirection.Out; -- Easing Direction
Enum.EasingStyle.Back; -- Easing Style
1 -- How Long Should The Tween Last Bro?
)