Value not changing in gui local script

local InSpace = script.Parent:WaitForChild("InSpace")
local Oxygen = script.Parent:WaitForChild("Oxygen")
local Radiation = script.Parent:WaitForChild("Radiation")
local Total = 100

InSpace:GetPropertyChangedSignal("Value"):Connect(function()
	if InSpace.Value == true then
		while InSpace == true do
			Oxygen.Value = Oxygen.Value - 1
			print("a")
			script.Parent:WaitForChild("OxygenMeter"):WaitForChild("Fill").Size = UDim2.new(1,0,(Oxygen.Value/Total),0)
			wait(2)
		end
	end
end)

i’m trying to do an oxygen system for my game and when i try to decrease it’s value it’s stays the same and won’t change.

i don’t get any error messages and i’m trying to figure out why
image

this is what my gui looks like

1 Like

is the “a” statement printing?

1 Like

it’s not printing either, i don’t know what’s wrong

1 Like

Ok. Just to figure out what part is going wrong, after the GetPropertyChangedSignal() statement, do print("Recieved") and make it print those variable values. Tell me what prints and what doesn’t.

1 Like

i may have figured it out, i didn’t put the .Value on the while InSpace == true do loop

2 Likes