Hello!
I am back with another problem. (ik i have a lot of problems)
so I was scripting a fuel cell consumption system for my game and then I realized something.
normally the 4 fuel cells would all wait between 60-107 seconds and then they would go down by 1%
instead of doing so, it waits for the fuel cell before it to go down by 1% and then it does the same thing
you know, like it’s yielding
for example, fuel cell 2 wont wait the time specified and then go down by 1%. instead, it waits for fuel cell 1 to decrease by 1% and then it does it.
code
local monitor = ControlRoom.ReactorMonitor
-- fuel cells
task.spawn(function()
while true do
if module.ReactorActive == true then
if module.OperationLevel == "normal" then
if module.FuelCell1Level > 4 then
task.wait(math.random(60, 107))
module.FuelCell1Level -= 1
end
if module.FuelCell2Level > 4 then
task.wait(math.random(60, 107))
module.FuelCell2Level -= 1
end
if module.FuelCell3Level > 4 then
task.wait(math.random(60, 107))
module.FuelCell3Level -= 1
end
if module.FuelCell4Level > 4 then
task.wait(math.random(60, 107))
module.FuelCell4Level -= 1
end
--- you can ignore the rest of the code
elseif module.OperationLevel == "low" then
if module.FuelCell1Level > 4 then
task.wait(math.random(65, 113))
module.FuelCell1Level -= 1
end
if module.FuelCell2Level > 4 then
task.wait(math.random(65, 113))
module.FuelCell2Level -= 1
end
if module.FuelCell3Level > 4 then
task.wait(math.random(65, 113))
module.FuelCell3Level -= 1
end
if module.FuelCell4Level > 4 then
task.wait(math.random(65, 113))
module.FuelCell4Level -= 1
end
elseif module.OperationLevel == "minimal" then
if module.FuelCell1Level > 4 then
task.wait(math.random(70, 120))
module.FuelCell1Level -= 1
end
if module.FuelCell2Level > 4 then
task.wait(math.random(70, 120))
module.FuelCell2Level -= 1
end
if module.FuelCell3Level > 4 then
task.wait(math.random(70, 120))
module.FuelCell3Level -= 1
end
if module.FuelCell4Level > 4 then
task.wait(math.random(70, 120))
module.FuelCell4Level -= 1
end
end
task.wait(.01)
end
task.wait(0.01)
end
end)
plz help
also you can ask for photos if you want