Is it possible to turn a string back into code?

I know you can do something like this with JSON, but I’d like to know if there are other ways.

There is no way to turn a string back into code using only Roblox Studio.
Roblox Studio basically has all of your code into a sandbox to prevent security breaches with their API’s, and possibly more sensitive info. And thus is the reason you can’t turn a string back into code.

They don't provide us with a tool that would allow us to do that, so your best bet is just to request the feature.

1 Like

You could use JSONEncode() with the string

loadstring() but that has to be enabled under ServerScriptService.

If you want to use it on the server, you can simply turn on LoadstringEnabled under ServerScriptService and then use loadstring(string)().

If you want to use it on the client, you can use this module. I used it before and it works well

2 Likes

No… JSONDecode and JSONEncode only works for tables, it’s not related.

However there’s something called loadstring() which you might wanna check out, and there’s a property called LoadStringEnabled.

Loadstring is a thing. You can enable it in ServerScriptService but I do not recommend using it.