The title might not say much but I have a button in a SurfaceGui that if clicked, creates a ScreenGui in the PlayerGui with Instance.New()

Most of it works fine except for the closing button which requires a bit of coding. So basically, how do I create a script with a script?

Here is what I've tried

Instance.new("Script", Sg.Notepad.Close)
	Sg.Notepad.Close.Script.Source = "script.Parent.MouseButton1Click:Connect(function()script.Parent.Parent.Parent:Destroy() end)"	

It might sound a bit confusing so feel free to ask questions.

2 comments

0

Welp that answers it