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?
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!