Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Unknown problem with my script builder??

Asked by
coo1o 227 Moderation Voter
10 years ago

So I am making a GUI-based script build with a TextBox and TextButton that runs the code when it's clicked. The main code is a LOCALScript under the ScreenGui there's a normal script with a StringValue as a child named "Source". The normal script is a child of the local script. ScreenGui -> LocalScript -> Normal script (So code doesn't run local) -> StringValue (Source) And yes, the normal script IS disabled.

Also the LocalScript is named "sfunction", the ScreenGui "scripter" and the normal script is named "runcode".

LocalScript's code:

local runscript = script.runcode
local screen = script.Parent
local frame = screen.Frame
local run = frame.run

run.MouseButton1Click:connect(function()
    local code = frame.tscript.Text
    local newscript = runscript:Clone()
    newscript.Parent = workspace
    newscript.Source.Value = code
    newscript.Disabled = false
end)

Normal script:

local source = script:WaitForChild("Source")
loadstring(source.Value)()

Output: 20:55:04.232 - An error occurred 20:55:04.233 - Script 'Players.Player1.PlayerGui.scripter.sfunction', Line 10 20:55:04.234 - stack end

Thank you

1 answer

Log in to vote
2
Answered by 10 years ago

This problem is occurring because your StringValue's name is "Source". Source is actually the name of a property of Scripts, and the ROBLOX API will prefer properties over hierarchal objects. The error occurs because the Source property isn't scriptable by Scripts or LocalScripts.

So, in short, to fix this problem, rename your string value "Source" to something else (like "code").

1
Thanks Kenetec! I forgot about the Source property! Thanks again! coo1o 227 — 10y
Ad

Answer this question