Ratio Bar not working as intended

Hey! So I’m following this tutorial on how to create a Health/Ratio bar, and I followed the exact steps in the tutorial but it doesn’t work at intended.

image

As you can see in this image, the actual moving part (known as ‘Top’ in the tutorial) is in the middle. On the tutorial post, someone said they are having this issue but no fix was mentioned.

This is the code:

-- ///////// GUI STATS \\\\\\\\\\ --
function resizeCustomLoadingBar(sizeRatio, clipping, top)
	clipping.Size = UDim2.new(sizeRatio, clipping.Size.X.Offset, clipping.Size.Y.Scale, clipping.Size.Y.Offset)
	top.Size = UDim2.new((sizeRatio > 0 and 1 / sizeRatio) or 0, top.Size.X.Offset, top.Size.Y.Scale, top.Size.Y.Offset)
end

while wait(1) do
    -- Ratio Bar
	local RatioInfo = ReplicatedStorage.RatioInfo.Team1.Value / ReplicatedStorage.RatioInfo.Team2.Value
	resizeCustomLoadingBar(RatioInfo, script.Parent.RatioBar.Clipping, script.Parent.RatioBar.Clipping.Top)
end

This is my structure:

image

Not to mention I also set the required properties in for the frames.

Thanks!

I managed to fix it by setting the Top and Clip’s anchor point to 0, 0.

Not to mention, the Clip frame isn’t even required. Just move the Top to be a child of the RatioBar, and delete the Clip frame. Although, you need to enable ‘ClipDescendants’ on the RatioBar frame.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.