Energy charge Bar changes position when tweening size?

So whenever I charge my energy there are two values: Ki, the value that is increased and MaxKi, the maximum value that the Ki can reach

local player = game.Players.LocalPlayer
local bar = script.Parent
local exp = player:WaitForChild("Ki")
local levels = player:WaitForChild("MaximumKi")


while wait() do
	bar:TweenSize(UDim2.new((exp.Value/tostring((levels.Value))), 0,1,0), "Out", "Quint", 0.3, true)
end

but when I do this then the Bar shifts slightly downwards for somereason?


it’s actually supposed to be this high

1 Like

Try setting the AnchorPoint to 0, 0.5 and then position the inner bar’s Y position to 0.5, 0

1 Like

How do I set the Y position part?

1 Like

Simple fix, make sure the bar is under the parent and it’s position is set to 0,0,0

1 Like

When changing the position, you should have 4 values which look something like this:

{0, 0}, {0, 0}
---------^ you’ll want to change this value to 0.5.

The first value between each of the brackets is the scale relative to the frame or user’s screen, and the second is the offset which is in pixels.

1 Like

when I try this now this happen:

Hmmm, maybe try setting the AnchorPoint to something like 0.25 or 0.75?
Also, just to be sure, you are using scale, not offset, correct?

yes i got it now i just had to make the anchor point 0,0
sorry for my bad english

1 Like