It just spreads out wrongly. Anyone know why?
https://gyazo.com/42a8c444e1e3baad33163a9c13835296
Here is the code
ExpBar:TweenSize(UDim2.new(Experience.Value/MaxExperience.Value,0,1,0), "Out", "Sine", 0.25, true)
It just spreads out wrongly. Anyone know why?
https://gyazo.com/42a8c444e1e3baad33163a9c13835296
Here is the code
ExpBar:TweenSize(UDim2.new(Experience.Value/MaxExperience.Value,0,1,0), "Out", "Sine", 0.25, true)
Assuming you mean you want the Bar to start from the left and go to the right instead of expanding from the center:
This is happening because when using scale
with UDim2
, it’s unsure wether to go from left or right (which is easy to guess with offset
because can have a negative or postitive value, and the sign describes which direction) so it splits the percentage between both sides.
What you can do instead is, have the blue frame start at the left of the main transparent bar, and tweening its size would just be:
ExpBar:TweenSize(UDim2.new(0,Experience.Value/MaxExperience.Value*MainFrame.Size.X.Offset,1,0), "Out", "Sine", 0.25, true)
where MainFrame
is the transparent frame. What will this do is find the percentage like you were doing (Experience.Value/MaxExperience.Value
) and multply it by the X of the MainFrame. Since the value would obviously be positive, the frame should only tween to the right.
Is the ExpBar’s AnchorPoint not 0,0?
I changed it to 0,0 now. Originally it was 0.5,0.5 . Thank you!