The number value doesn't add up

I’m trying to make the temperature system that rises up or cools down, but it doesn’t work.

The script used to rise the temperature:

local Temperature = game.ReplicatedStorage.ReactorSystems.Temperature

local function temperature_rise()
	local temp = math.floor(Temperature.Value)
	temp = temp + 5
end

while task.wait(1) do
	temperature_rise()
end

Any help is appreciated, thanks.

1 Like

If you’re changing the value, you’ll always have to apply the final change to Temperature.Value.

local Temperature = game.ReplicatedStorage.ReactorSystems.Temperature

local function temperature_rise()
	local temp = math.floor(Temperature.Value)
	Temperature.Value = temp + 5
end

while task.wait(1) do
	temperature_rise()
end

It works now, thanks for solving my problem.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.