i'm trying to create a text button and then input a local script into it as a child which will run the textbutton. Is there anyway to do this all in the same script that is creating the text button?
COMMUNITY QUESTION
is it possible to add a script using instance.new and also add code to that script?
3 answers
Don't use a Instance its best to use spawn creates a script you can code in
spawn(function()
--Code
end)
For more info go to http://wiki.roblox.com/index.phptitle=Global_namespace/Roblox_namespace#spawn
You could also just make the gui then put it into ReplicatedStorage, Lightin, but not in starterGui, when you want to open the gui, put the gui you want to appear in the PlayerGui of the LocalPlayer, It's easier!
That would be a Coroutine
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Yes it is possible to do both of those things. But the Source is limited to studio only as it is a http://wiki.roblox.com/index.php?title=API:ProtectedString
But I am not sure you need this. You can connect any event for this new text button without any additional scripts.