I want to make an oxygen system.
It just won’t work. It’s supposed to make the meter go down when underwater, i already have the underwater part working, THIS WONT WORK THOUGH.
local IsDrown = script.Parent:WaitForChild("IsDrown")
local oxygen = script.Parent:WaitForChild("oxygen")
local plrgui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
IsDrown.Changed:Connect(function()
print("mhm")
if IsDrown.Value == true then
print("alr")
repeat
if IsDrown.Value == true then
print("ohk")
wait(1)
oxygen.Value = oxygen.Value - 1
plrgui.Oxygen.TextLabel.Text = "oxygen: ".. oxygen.Value
end
until oxygen.Value <= 0
end
end)