What could be causes of softlocks?

As a general rule, try to avoid globals entirely if you can. I don’t have any at all (unless I make a mistake and accidentally create one), instead I have files which return a table for values that need to be references in multiple files.

I would also say try not to have too many individual local variables at the top of any file. If you have lots of variables you can probably condense them into a single table.

I won’t send the whole code 'cause it’s about 5k lines long

If that’s all in one file, I would definitely recommend splitting it up into multiple files. It will become really unmanageable if every aspect of the game is in one file. AI tools will probably be able to do it for you.

I even noticed that i couldn’t write --[]-- comment at some point in area of that function

This problem wasn’t related to your error, it’s most likely because you have characters in the code you are trying to comment out. Try putting an equals sign between the comment block markers, as that should allow the comment to work:

--[=[ 
block comment here
--]=]

You can even nest block comments this way, by using different number of equal signs

--[=[
this is comment block 1
this is comment block 1
    --[==[
    this is nested comment block 2
    this is nested comment block 2
    --]==]
this is comment block 1
this is comment block 1
--]=]
2 Likes