Can someone explain this error ?
Script timeout: exhausted allowed execution time
1 Like
This basically just means the script is trying to run, but something is stopping it/not letting it run. So, it âgives upâ because it exhausted the amount of time to perform its function.
You will get this error if you are spamming the script (think a while true loop without a âwait()â)
Several other topics about this:
I have a long running script that performs a minimax search of a game tree.
Testing locally, it looks like my script gets killed after ~20 seconds and I get the error âScript timeout: exhausted allowed execution timeâ. I assume this would happen on production also.
What is the best way to handle this? I donât really understand how script execution works in Lua. I think there are actually two problems:
My long running script is probably blocking all other scripts from running. Is there a way âŚ
So I was using a while true do loop to rotate âhandlesâ for a shop inventory. Of course this means that all the handles are rotated simultaneously, as I canât seem to find a way to rotate a specific handle if that viewport frame for the handle was open. Anyways I have a large amount of handles, and a simple loop had resulted in this error.
script timeout: exhaustion allowed execution time
When I opened up the shop, studio literally froze for around 10 seconds. Why is this? Is it because my looâŚ
Hello, when I try to run my script
local Target = game.ReplicatedStorage.NPC
local Script = game.ReplicatedStorage.NPC:WaitForChild("Script")
function onTouched(hit)
if game.Workspace.Value.Value == 1 then
Target.Parent = game.Workspace
Script.Disabled = false
wait(0.50)
Target.Parent = game.ReplicatedStorage
Script.Disabled = true
script.Disabled = true
wait()
end
end
script.Parent.Touched:connect(onTouched)
it freezes my testing window and says âScript timeout: exhausted allâŚ
Iâm doing something that takes a long time for a script to process and I need the script, not to TimeOut.
when I try to set the Script Timeout I get an error.
Players.ffancyaxax12.PlayerGui.LocalScript:11: attempt to index nil with âSetTimeoutâ
local scriptContext = game:GetService("ScriptContext")
scriptContex:SetTimeout(100)
Even though its on the Roblox DevFourm.
https://developer.roblox.com/en-us/api-reference/function/ScriptContext/SetTimeout
2 Likes
D0RYU
(nici)
May 21, 2021, 1:41pm
#3
can you show you the script please
This is where the error happens,
the line before the last line
function core.spawn(func,âŚ)
local connection = event.Event:Connect(func)
event:Fire(âŚ)
connection:Disconnect()
end
This has nothing to do with loops
This also happens for Changed
events, so if youâre detecting for a specific Instance/Value to change & youâre increasing it, that also results in that error
I will explain more
function core.spawn(func,âŚ)
local connection = event.Event:Connect(func)
event:Fire(âŚ)
connection:Disconnect()
end
This is in Module script ^^^^
This is in server script vvvvv
wait(2)
core.spawn(searchTargetLoop)
wait(2)
core.spawn(attackLoop)
wait(2)
core.spawn(movementLoop)
wait(2)
core.spawn(aimingLoop)
fela_mon
(coolboy45)
May 21, 2021, 1:58pm
#7
This happens if you multiply or use âwhile true doâ
D0RYU
(nici)
May 21, 2021, 2:00pm
#8
did you not even decide to read the replys
yea thats true but for every core.spawn(function) , the function has only 1 while loop, and i separate the core.spawns functions wit 2 seconds⌠idk wats wrong tho