You could use the TweenSize
function specific to GUI objects, but I personally like to stick with TweenService
. (here's the wiki page on TweenService)
So, there's one function, Create
that requires 3 parameters. The Instance
you want to tween, the TweenInfo
for the the instance in question and a table containing the properties you want to tween.
All in all, it should look a little like:
1 | local TweenService = game:GetService( 'TweenService' ) |
5 | TweenInfo.new( 1 , Enum.EasingStyle.Linear, Enum.EasingDirection.Out), |
7 | Size = UDim 2. new(currentXp / xpRequired, 0 , 1 , 0 ) |
Hopefully the arguments passed are pretty self-explanatory! Of course, you could store the tween created in a variable to be played every time the player's experience changes.