Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Simple GUI Library Example for Solara
- local Library = {}
- -- Create Window function
- function Library:CreateWindow(title)
- local window = Instance.new("ScreenGui")
- window.Name = title
- window.Parent = game:GetService("CoreGui")
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 300, 0, 200)
- frame.Position = UDim2.new(0.5, -150, 0.5, -100)
- frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- frame.Parent = window
- local titleLabel = Instance.new("TextLabel")
- titleLabel.Size = UDim2.new(1, 0, 0, 40)
- titleLabel.Text = title
- titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- titleLabel.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- titleLabel.Parent = frame
- -- Return the window object for further customization
- return {
- Window = window,
- Frame = frame,
- TitleLabel = titleLabel
- }
- end
- -- Create Toggle button function
- function Library:CreateToggle(label, callback)
- local toggleFrame = Instance.new("Frame")
- toggleFrame.Size = UDim2.new(1, 0, 0, 50)
- toggleFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- toggleFrame.Parent = self.Frame
- local toggleLabel = Instance.new("TextLabel")
- toggleLabel.Size = UDim2.new(0.6, 0, 1, 0)
- toggleLabel.Text = label
- toggleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- toggleLabel.BackgroundTransparency = 1
- toggleLabel.Parent = toggleFrame
- local toggleButton = Instance.new("TextButton")
- toggleButton.Size = UDim2.new(0.3, 0, 1, 0)
- toggleButton.Position = UDim2.new(0.7, 0, 0, 0)
- toggleButton.Text = "OFF"
- toggleButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
- toggleButton.Parent = toggleFrame
- toggleButton.MouseButton1Click:Connect(function()
- if toggleButton.Text == "OFF" then
- toggleButton.Text = "ON"
- toggleButton.BackgroundColor3 = Color3.fromRGB(50, 200, 50)
- callback(true)
- else
- toggleButton.Text = "OFF"
- toggleButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
- callback(false)
- end
- end)
- return toggleButton
- end
- return Library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement