I’ve been interested in using the loadstring function in roblox, and after spending well over 8 hours on a very strict sandbox/filter for the code, I was ready to implement loadstring and quickly found out it wasn’t working… I have LoadStringEnabled enabled and I’ve restarted the client but it still is unknown. (The code is on a server script under ServerScriptService)
It was my fault for not checking this before taking such a large task. However now I’m just trying to salvage as much of that work as possible.
(I am well aware of the risks that loadstring posses, and that’s why I spent so much effort in designing the sandbox)
The error is showing up even in this very basic script.
So I was very tired that night and noticed that the editor was saying loadstring did not exist. I never bothered to just run it anyways but it turns out it runs just fine, the editor will just yell at you that the function does not exist even though it does.
I shouldn’t have used the word error in my original post as I think it misled people into thinking it was throwing an error at run time rather than the editor just yelling at me.
Just so you know, loadstrings are very like a rickety process.
loadstring() is no longer a registered global and no longer “highlights” once used, it’s still functional if you enable LoadstringEnabled regardless of the warning beforehand.
However, there is a way around this!
How to use:
local Loadstring = require(path.to.module)
Loadstring("code here")
Note that by using this, you do not have to enable LoadstringEnabled.