Loadstring() is not available

I’m trying to make an admin console where you can execute client scripts, and it keeps giving me this error:
“loadstring() is not available”.
script.Parent.MouseButton1Click:Connect(function() loadstring(script.Parent.Parent["script entry"].executor.Text) end)

I made sure LoadstringEnabled was enabled, but it still gives me the error.
Any help would be appreciated!

When using loadstring, you need to have loadstring(text)(). You need to call the function loadstring returns.

Although, I do feel like I need to just say that, you need to be very carful to make sure that no exploiter will be able to exploit your admin console to allow them to run their own server-sided scripts. Make sure any remote events/functions are checked to make sure that the player that fires them is actually an admin.

Still doesn’t work. I looked for typos as well but there are none.

Use a FiOne module, search “FiOne” in the toolbox and use it by doing require(module)(“LoadstringDataHere”)

Edit: it’s either require(module)(“LoadstringDataHere”) or require(module)(“LoadstringDataHere”)() I can’t remember

I can’t believe nobody has mentioned this!

loadstring() will not work on the client (It will not work in localscripts), it only works on the server (This has to do with security reasons).

Heres a modulescript that you can use instead of loadstring that will actually work on the client:

If you need help with using the module (it is a bit complicated), please don’t hesitate do reply asking me for help.

2 Likes

A lot of times loadstring may not be a very good way to execute scripts. I suggest using a lua VM module. Heres one of the first results I found: www.roblox.com/library/5041463280/Lua-VM

Just do

local vm = Path.to.Module

vm("your code")