Hello guys,
I have a problem:
I get in the Output: Game script timeout
I tried many things to solve the problem, but nothing solve them.
This is a normal script not a local or a module script.
The script do this:
The script check if the time after midnight is 1080.
I have two other script for this script.
Modulscript:
local minutesAfterMidnight = 780
return minutesAfterMidnight
The second script makes the minutesAfterMidnight work.(<--this script work without error)
I tried this:
--fog
game.Lighting.FogEnd = 8000
game.Lighting.FogStart = 1
minutesAfterMidnight = require(game.ServerScriptService.weathersystem.ModuleScript1)
-- This connect the modul script whit this script /\
while true do
if minutesAfterMidnight == 1080 then
for count = 1, 7000 do
print("debug3")
game.Lighting.FogEnd = game.Lighting.FogEnd - 1
wait (1)
end
for count2 = 1, 7000 do
print("debug4")
game.Lighting.FogEnd = game.Lighting.FogEnd + 1
wait (1)
end
end
end
between while true do and the last end is the error.
I tried to set the count from 7000 to 7 down but that wasn`t the problem (I thought that was the problem)
I tried also this:
--fog
game.Lighting.FogEnd = 8000
game.Lighting.FogStart = 1
while true do
if minutesAfterMidnight == 1080 then
for count = 1, 7000 do
print("debug3")
game.Lighting.FogEnd = game.Lighting.FogEnd - 1
wait (1)
end
for count2 = 1, 7000 do
print("debug4")
game.Lighting.FogEnd = game.Lighting.FogEnd + 1
wait (1)
end
end
end
I tested instead of minutesAfterMidnight also clocktime == "18:00:00" and I tested to put at the other script _G.minutesAfterMidnight = 780.
I houp you knew a solution.
Thanks in previous.

1 comment
Timeout means that the loop is being run way too many times, You need to add a wait() after while true do, + your minutesAfterMidnight doesn't equal 1080 so