local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
while true do
wait()
script.Parent.Text = char.Values.Oxygen.Value
end
for some reason whenever the character dies this script stops working and doesn’t display oxygen, please help
in your screengui, check that “resetonspawn” is set to false
and also the character is another problem in this script, you don’t do any checks for validity of the character nor assign it again
1st step: Set this to false:

2nd step: Use this script as it won’t break:
local players = game:GetService("Players")
local localPlayer = players.LocalPlayer
local oxygenLabel = script.Parent
local function checkOxygen()
local char = localPlayer.Character --Don't need to say "or characteradded:wait()" because the function returns and the loop will just check it again!
if not char then return end
local values = char:FindFirstChild("Values")
if not values then return end
local oxygenValue = values:FindFirstChild("Oxygen")
if not oxygenValue and not oxygenValue:IsA("ValueBase") then return end
oxygenLabel.Text = oxygenValue.Value
end
while task.wait() do
checkOxygen()
end
Tips:
1st: Don’t store important things under or as an attribute to the player’s character model, since their client changes in their avatar replicate to the server, meaning that your values under the character can be exploited. Store them in the player, (or in the server storage, but that is more advanced and would require remote functions)
2nd: If you don’t like those many lines of code, (which are there just to ensure that the script won’t break, and won’t slow it down at all) you can use coroutines or pcalls, etc…
3rd: The category is actually scripting support 
4th: Forgot about it, but if you are not sure if something exists or not, use findfirstchild instead of the dot operator (don’t use it in player.Character since that’s a property of the player and won’t error if it doesn’t exist).
also next time please show us what you’ve got in the console and the game explorer if it’s possible, tell me if it works!
oh there was no errors, it worked as intended until i reset.
what happened when you reset? also please check you have the updated version of the script
Send me a video if possible
um it works fine in studio but breaks in real game

ok wait, found why 30chaaa racters
check the script again, totally forgot to add findfirstchild instead of dot operator, check the big message again
Just in case, if you want, check this out:
xddd.rbxl (39.8 KB)