I’m encountering the “Max lua stack size reached” error in Roblox Studio. I’m not sure what is causing the issue.
I’ve checked my code, and there don’t seem to be any infinite loops or obvious recursive calls, but I still can’t resolve the error. Does anyone have experience with this issue and know what the possible causes might be or how I can fix it?
Are you doing anything like modifying a Value inside of its .Changed event?
Otherwise we’ll probably need to see the code where the error is coming from.
The stack is mainly used to store local variables, so check for something that could be declaring an unintended amount. That’s about all I can tell without seeing your code.
Adding onto this, it could also be function calls (non-fastcall, more than 3 arguments), so you could also try looking for a function call with a large amount of arguments.
Well the error you’re getting is pretty ambiguous, I’m not really sure how you could approach it either. Might even be an engine bug, so unless you get a solution here I’d suggest reporting it.
I did my research, and found out that it happens when you use too many variables. What is the biggest script you have on your game? Does it have lots of variables?
Yeah, but it won’t pop the error “Max lua stack size reached”. I know it will pop other ones, but it is only an experience that you could easily revert back to normal