A way to kill specific threads

As a Roblox developer, it is currently too hard to kill threads in lua code.

If Roblox is able to address this issue, it would improve my development experience because it would allow me to safely kill threads without weird/hacky methods and implement proper termination in my script sandboxing tool

Currently my solution is to sort of trick the engine into running the threads inside of a BaseScript instance. I can then set .Disabled to true and the engine will kill all of the threads in a script. Then I can disconnect events and things myself. This is really hacky and can be circumvented easily.

There is no way to do this for ModuleScripts.
There is also no way to do this without an extra BaseScript instance.

If I could target a specific thread and kill it, I could do the same things I do with events and kill each thread the script created one by one.

Games like Lua Learning and Void SB could greatly benefit from a feature like this because it would make it possible for them to safely terminate user ran code.

Currently, at least in Void SB, there are a lot of people who run scripts that are impossible to terminate with the in game commands. This makes it possible for abuse and potentially impossible for their moderators to effectively stop inappropriate content if it were to become a problem.

Games which don’t run user code could benefit too because it would allow them to start and stop processes on the fly. This would be potentially very useful for Parallel Lua.

7 Likes