I'm well aware It has something to do with tweensize as far as knowledge goes, but what I cannot figure out is how to get the value of the current experience you may have gamed in a game, and have the experience war resized based on how much experience you have until the next level.
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:
local TweenService = game:GetService('TweenService') TweenService:Create( bar, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), { Size = UDim2.new(currentXp / xpRequired, 0, 1, 0) } ):Play()
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.