UI Bar doesn't go the way intended

Alright, so I have been trying to achieve an oxygen bar that goes down when you swim underwater, but somehow the bar goes the other way.

the oxygen bar
image

I tried searching on the Dev Forum for answers, but no one seems to have posted about this.

video of the oxygen bar

local script that changes it

game:GetService("RunService").RenderStepped:Connect(function()
	script.Parent.fill.Size = UDim2.new(0.07, 0,script.Parent.Parent.Parent.Character.OxygenAmount.Value / 100000, 0)
end)

The OxygenAmount Value is normally set to 10000, and it goes down really fast.
Thank you for any help.

did you try this?

-script.Parent.Parent.Parent.Character.OxygenAmount.Value / 100000

That’s what I did. Look in the script I provided.

lower values on the Y-axis are towards the top of the screen not the bottom, make sure your graphic has its AnchorPoint set at the bottom of the element and place it at the bottom of the tanks accordingly

2 Likes

Thank you. That seemed to fix it.

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