Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

"loadstring() is not available"?

Hello there! I'm currently working on a script builder. The script builder works in studio, but not online. Whenever I test it online and look at the Roblox Developer Console, it says "loadstring is not available". Here is the script:

source = script.Parent.ScreenGui.Frame.ScrollingFrame.TextBox
local val = source.Value.Value
if source then
val = source.Text
local code = loadstring(val)
code()
print("Success!")
else
	print("Error while trying to load script")
end

It says the error is on line 5. Please help.

2 comments

0

By the way, I have LoadStringEnabled in ServerScriptService, so it should work

0

loadstring is only available for server scripts (not LocalScripts), which is clearly documented on the Wiki.

1 answer

Try this

source = script.Parent.ScreenGui.Frame.ScrollingFrame.TextBox
local val = source.IntValue.Value -- You cant name a Value "Value" that will give errors
if source then
val = source.Text
local code = loadstring(val)
code()
print("Success!")
else
    print("Error while trying to load script")
end

This discussion is preserved as it was. New answers, comments, and votes are closed.