Script Timeout: Exhausted allowed execution time

If you think there are no issues with loops you can change the max execution time through your studio settings.

1 Like

Then show us more of your code to better analyse the problem, we don’t know when the function gets ran.

1 Like

I’m wondering why it even errors here in the first place as it didn’t happen yesterday (I didn’t do any modification to the code).

1 Like

If it was me I would see what happens when you change the max execution time. You can set it to -1 and there will be no time limit.

2 Likes

The function gets ran when the player touches a teleporter.

1 Like

I have this in my bookmarks and this solution always works for me (make sure you call MaybeYield() where this error occurs)

2 Likes

I’m gonna try it, I’ll post the result one done.

2 Likes

Try adding a debounce to the touched function.

There is already one.

charaaaa

Then i have no idea what the problem is, maybe just a bug in studio or something.

1 Like

Call MaybeYield() before you map.Parent=workspace

I think the map is big and it yields script for very long time which makes it execution timeout

2 Likes

I’m not sure how i can implement those functions in my script since they aren’t loops, and I also tried putting a task.wait() before and after map.Parent = workspace.

what if you put task.wait() before rf.mapdebris:ClearAllChildren()

I tried doing so, it obviously removed the error but what I’m trying to figure out is why it errors there (on other terms, why it lags this much).

I actually removed the rf.mapdebris:ClearAllChildren() line because i realized that the folder wasn’t even being used anywhere in the script.

Except loops without wait time, this error can also be caused by too much thread or too much things that run at same time.

The output say it is comming from your 3 functions (loadmap, teleport, touched), so something in one of these function is doing too much things at same time… keep in mind a for_ do is also a loop, in case you got one or multiple for loop.

2 Likes

I’m gonna try and add a task.wait() on most of the lines and see which one makes me lag the most, and no, there are no for loops.

According to my testing, it’s because of parenting the Map in the workspace. I also said the same thing on the post.

I tried parenting the Map into workspace myself while play-testing, and It made me lag for around 10 to 15 seconds. The issue might just come from my computer, but I doubt it since it worked fine 2 days ago.

What are the contents of CharacterScript? It appears the issue is solely specific to that script, judging by the output you sent.

Would you be able to send the code? Also, I’d recommend copying the code as text instead of an image, and sandwich them between " ``` ".

Example

This:
```
local localPlayer = game:GetService(“Players”).LocalPlayer
print(localPlayer.DisplayName)
```

will become:

local localPlayer = game:GetService("Players").LocalPlayer
print(localPlayer.DisplayName)

This will make it easier for us to test your code since we only have to copy text and not manually type them from screenshots.