Script timeout: exhausted allowed execution time

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:

2 Likes

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)

This happens if you multiply or use “while true do”

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