i'm making an underwater game of sorts. Hence the need for an oxygen script. it would need to know to start gradually decreasing the oxygen bar when the player is fully submerged in water, and then increase the amount of oxygen in the bar when the player comes into contact with the surface or air bubbles. I know this is probably a complicated script, and I have no idea how to write it out.
anyone have an idea on how to do this?