Hello!
I would like to script a system in my game that checks if two bool values are at certain values and then change a textlabel on a surfacegui in accordance to what the values are at currently, sort of like a cooling system in a nuclear reactor/reactor core game where the temperature reader goes up if the cooling system isn’t on and goes down when the cooling system is on.
Before I explain the problem, here is my script:
local value1 = game.ReplicatedStorage.boolfolder.BoolOne
local value2 = game.ReplicatedStorage.boolfolder.BoolTwo
local number = Instance.new("NumberValue")
number.Parent = script.Parent
number.Value = 400
local textlabel = script.Parent
textlabel.Text = number.Value
while true do
if value1 or value2 == true then
number.Value = number.Value + 1
elseif value1 and value2 == true then
number.Value = number.Value + 5
elseif value1 and value2 == false then
if number.Value > 400 then
number.Value = number.Value - 1
end
end
wait(0.75)
end
The textlabel’s text ends up changing to the number 400 when the server starts, but that’s the only thing that works. The number value never changes at all, even when I press a button that turns the boolean values off and on.
The script is supposed to make the number on the textlabel go up by five when both boolean values are true, go up by one when only one boolean value is false, and go down by one if both boolean values are false until it the number reaches 400 again.
The script I use is a regular script inside of a textlabel on a surfacegui, in case that information is needed.
I’ve tried looking everywhere, yet I can’t find a solution.
Can somebody help? Thanks!