How to prevent malicious loops for user-generated code (loadstring)

  1. What do you want to achieve?
    I want to somehow prevent code which was ran via loadstring to be able to make while true do end loops

  2. What is the issue?
    I dont know how to do so, i would use an interpreter (like FiOne) and edit it but then the sandbox for other things (preventing from accessing things such as game and etc.) wouldn’t work

  3. What solutions have you tried so far?
    I have tried using metatables but that didn’t work
    I also tried using an interpreter but then i couldn’t get the rest of the sandbox to work
    My current guess is to use string.find but if theres a better and easier method then please let me know


oops i used the wrong tag somehow
fixed now