i have a script that generate a random world and if i run the script i get an error says that the script time out
ok you may say just add a wait or task.wait ?
sadly this will make the generation take around 4-6 min !
i am also tried to use settings().Studio.ScriptTimeOut = math.huge
and settings().Studio.ScriptTimeOut = -1
and iam getting this error below
You’re the first guy i see that try to disable/bypass an error instead of just fixing your scripts xD
You obviously can’t change that, ScriptTimeOut is an error meaning that your code run too fast and is monopolizing the script executor for too long, it is preventing huge lags and crashes… so even if you were able to change it, it still would make your game unplayable.
The only solution is to yield the code by adding a wait time or to use parallel luau to split the task.
If your generation takes way longer by adding a task.wait(), then you’re adding it in the wrong scope. Instead of adding a task.wait() between each piece of the world you generate, add it between each chunk, or in intervals depending on the chunk number.
I don’t know how your generator works so I can’t help further.
You can also use parallel lua, but a couple days ago me and a friend tried it, and it ended up freezing the entire Studio process because somehow it didn’t yield, so be careful with that, lol.
You can try to split the generation into 4 different steps.
Let’s say you have to generate 100 rooms, then you could split it to 25/25/25/25, and the 4 steps are generating at same time.
exemple:
local function GenerateMap(Step)
for Room = 1, 25 do
if Step == 1 then
--Generate the tier 1/4 of the map
elseif Step == 2 then
--Generate the tier 2/4 of the map
elseif Step == 3 then
--Generate the tier 3/4 of the map
elseif Step == 4 then
--Generate the tier 4/4 of the map
end
task.wait()
end
end
for Step = 1, 4 do
task.spawn(GenerateMap, Step)
end
thanks you for the example
my generation is not working like this it is more
complicated it is like biomes and every biome have like parts in it
i can send you the code if you could help with that
also my script have many functions in it could this be the problem ?
i see like other engines like Unity does not have this script time out error i really donot know why it is in roblox