Why won't a NumberValue change?

What is supposed to happen here is, you press one button, something happens to all these values. Press two, that effect is greater, and press all three, that is the greatest the effect can get.
My code: (This is placed inside the reactor)

local Temperature = script.Parent.Temperature
local Pressure = script.Parent.Pressure
local rodsUpIn = script.Parent.RodsUpIn
local rodsMidIn = script.Parent.RodsMidIn
local rodsDownIn = script.Parent.RodsDownIn

if rodsUpIn.Value == true and rodsMidIn.Value == true and rodsDownIn.Value == true then
	local increaseTemp = Temperature.Value/100
	local waitTime = math.random(4, 10)
	for Temperature = 0, increaseTemp do
		Temperature.Value = Temperature.Value + increaseTemp
		wait(waitTime)
	end
	local increasePressure = Pressure.Value/100
	for Pressure = 0, increasePressure do
		Pressure.Value = Pressure.Value + increasePressure
	end
elseif rodsUpIn.Value == true and rodsMidIn.Value == true or rodsUpIn.Value == true and rodsDownIn.Value == true or rodsMidIn.Value == true and rodsMidIn.Value == true then
	local increaseTemp = Temperature.Value/150
	local waitTime = math.random(4, 10)
	for Temperature = 0, increaseTemp do
		Temperature.Value = Temperature.Value + increaseTemp
		wait(waitTime)
	end
	local increasePressure = Pressure.Value/150
	for Pressure = 0, increasePressure do
		Pressure.Value = Pressure.Value + increasePressure
	end
elseif rodsUpIn.Value == true or rodsMidIn.Value == true or rodsDownIn.Value == true then
	local increaseTemp = Temperature.Value/200
	local waitTime = math.random(4, 10)
	for Temperature = 0, increaseTemp do
		Temperature.Value = Temperature.Value + increaseTemp
		wait(waitTime)
	end
	local increasePressure = Pressure.Value/200
	for Pressure = 0, increasePressure do
		Pressure.Value = Pressure.Value + increasePressure
	end
end```

Try this

local Temperature = script.Parent.Temperature
local Pressure = script.Parent.Pressure
local rodsUpIn = script.Parent.RodsUpIn
local rodsMidIn = script.Parent.RodsMidIn
local rodsDownIn = script.Parent.RodsDownIn

local waitTime = math.random(4, 10)
if rodsUpIn.Value and rodsMidIn.Value and rodsDownIn.Value then
	local increaseTemp = Temperature.Value/100
	for _ = 0, increaseTemp do
		Temperature.Value += increaseTemp
		task.wait(waitTime)
	end
	local increasePressure = Pressure.Value/100
	for _ = 0, increasePressure do
		Pressure.Value += increasePressure
	end
elseif rodsUpIn.Value and rodsMidIn.Value or rodsUpIn.Value and rodsDownIn.Value or rodsMidIn.Value and rodsMidIn.Value then
	local increaseTemp = Temperature.Value/150
	for _ = 0, increaseTemp do
		Temperature.Value += increaseTemp
		task.wait(waitTime)
	end
	local increasePressure = Pressure.Value/150
	for _ = 0, increasePressure do
		Pressure.Value = increasePressure
	end
elseif rodsUpIn.Value or rodsMidIn.Value or rodsDownIn.Value then
	local increaseTemp = Temperature.Value/200
	for _ = 0, increaseTemp do
		Temperature.Value += increaseTemp
		task.wait(waitTime)
	end
	local increasePressure = Pressure.Value/200
	for _ = 0, increasePressure do
		Pressure.Value += increasePressure
	end
end

If it doesn’t work, is there an error?

Didn’t work, and no error. Do I have to test this outside of Studio?

Can you send a screenshot of the hierarchy? where they are located

Ok, here it is:

(All the buttons and stuff are there, I just excluded them)

So, is the script just like that or is it connected to something else? Also, do you make the changes from the client or from the server?

I’m not sure if the elseif structure is correct.

E.g. (in my opinion) if all values are true, you could get into 1st and last elseif case.
I don’t know how Roblox/LUA handles this, probably it ignores both.

Use some print() to see which case occurs.

1 Like

Made from the server. And what do you mean by is it connected to something else?

Tried this, figured out that Roblox just completely disregards all code after the first if statement, I have no idea why

Probably that is always true?
I checked my theory, the following code will print always 1:

if true then
print (1)
elseif not false then
print (2)
end

Are you sure that values can be anything but true?

Yes. I had checked the values to the control rods being on after pressing the buttons for them, they all worked