How do I make an oxygen system for my game?

Happy to help!

Just FYI, the reason it is printing while in the air, is because you are raycasting downwards without taking into account if the player is on the ground of not.

To fix this, add the FloorMaterial check into the if statement.

if Material ~= Enum.Material.Water and Material ~= Enum.Material.Air and Player.Character.Humanoid.FloorMaterial ~= Enum.Material.Air then
1 Like

altho it’s not the same script as mine, this might prove to be useful as well, thx for that.