local GUI = Instance.new("ScreenGui", game.CoreGui) GUI.Name = "My GUI" -- Frame local mainFrame = Instance.new("Frame", GUI) mainFrame.Size = UDim2.new(0, 100, 0, 100) mainFrame.Position = UDim2.new(0, 300, 0, 50) mainFrame.BackgroundColor3 = Color3.new(1, 1, 1) mainFrame.Name = "My Frame" mainFrame.Active = true mainFrame.Draggable = true -- Title local title = Instance.new("TextLabel", mainFrame) title.Name = "My title" title.Text = "This is My GUI" title.Size = UDim2.new(0, 100, 0, 20) title.BackgroundColor3 = Color3.new(1, 1, 1) title.TextScaled = true title.Position = UDim2.new(0, 0, 0, 0) -- button local button = Instance.new("TextButton", mainFrame) button.Size = UDim2.new(0, 100, 0, 20) button.Position = UDim2.new(0, 0, 0, 20) button.Name = "My Button" button.Text = "Click me" button.TextScaled = true button.BackgroundColor3 = Color3.new(1, 1, 1) -- Event when clicked button.MouseButton1Click:Connect(function() print("hello world") end) -- Open / Close Button local Close = Instance.new("TextButton", GUI) Close.Size = UDim2.new(0, 40, 0, 40) Close.Position = UDim2.new(0, 0, 0, 150) Close.Name = "Close and Open" Close.BackgroundColor3 = Color3.new(1, 1, 1) Close.Text = "Open/Close" Close.TextScaled = true -- Event Open and close Close.MouseButton1Click:Connect(function() if mainFrame.Visible then mainFrame.Visible = false elseif not mainFrame.Visible then mainFrame.Visible = true end end)