Often within the Scripting Support categories, I’ve taken notice to a lot of responses informing you that you need to disable LoadStringEnabled otherwise your game is up for exploiter attacks or some kind of other nonsense. The Game Security article to which is mentioned in the LoadStringEnabled warning doesn’t do much of a good job explaining the potential risks of it either.
Due to all these responses, misconceptions and lack of information, I’d like to respond semi-decisively to the debacle regarding LoadStringEnabled:
Read the warning message very carefully. It is displayed before you enable LoadStringEnabled to inform you that there can be consequences for using it, especially if your game’s structure is poor.
Activating the LoadStringEnabled property might make your game vulnerable to exploits.
If you have any reason to be arbitrarily running code from the server with the global loadstring(s)
without a custom interpreter, I won’t question your use case - feel free to enable it. That being said, don’t let answers without detailed explanations or the warning throw you off and don’t let this PSA drop your guard either. Poor game structures with LoadStringEnabled put you at great risk for exploits.
The typical recommendation is that you don’t enable this, as there are rare to no cases in which you actually need to run arbitrary code independent from the game structure you coded from Studio. In the case that you do need this, custom interpreters and sandboxing techniques are available and should be used to “minimise” risk while keeping the feature enabled.
Thought I’d share. I have absolutely no knowledge on VMs, interpreters or anything technical about Lua, so if there’s feedback or something that I’ve gotten wrong or missed, please feel free to point it out to me and I’ll make sure to incorporate the feedback accordingly.
Happy developing and remember to practice safe coding when it comes to client-server interaction. You don’t want exploited clients taking advantage of vulnerabilities in your game.