Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local MartinUI = {}
- local TweenService = game:GetService("TweenService")
- local UserInputService = game:GetService("UserInputService")
- local HttpService = game:GetService("HttpService")
- function MartinUI:Create(config)
- local MartinScreenGui = Instance.new("ScreenGui", game.CoreGui)
- MartinScreenGui.Name = "MartinUI"
- MartinScreenGui.ResetOnSpawn = false
- local MainFrame = Instance.new("Frame", MartinScreenGui)
- MainFrame.Size = UDim2.new(0, 500, 0, 300)
- MainFrame.Position = UDim2.new(0.5, -250, 0.5, -150)
- MainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- MainFrame.BorderSizePixel = 0
- MainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
- MainFrame.Active = true
- MainFrame.Draggable = true
- local Title = Instance.new("TextLabel", MainFrame)
- Title.Size = UDim2.new(1, 0, 0, 40)
- Title.BackgroundTransparency = 1
- Title.Text = config and config.Title or "Martin UI"
- Title.Font = Enum.Font.SourceSansBold
- Title.TextSize = 22
- Title.TextColor3 = Color3.fromRGB(255, 255, 255)
- local Scroller = Instance.new("ScrollingFrame", MainFrame)
- Scroller.Size = UDim2.new(1, -20, 1, -50)
- Scroller.Position = UDim2.new(0, 10, 0, 45)
- Scroller.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- Scroller.BorderSizePixel = 0
- Scroller.ScrollBarThickness = 6
- Scroller.CanvasSize = UDim2.new(0, 0, 0, 0)
- Scroller.AutomaticCanvasSize = Enum.AutomaticSize.Y
- Scroller.AutomaticSize = Enum.AutomaticSize.None
- local UIList = Instance.new("UIListLayout", Scroller)
- UIList.Padding = UDim.new(0, 8)
- UIList.SortOrder = Enum.SortOrder.LayoutOrder
- -- زرار
- function MartinUI:Button(text, callback)
- local Btn = Instance.new("TextButton", Scroller)
- Btn.Size = UDim2.new(1, -10, 0, 40)
- Btn.Text = text
- Btn.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- Btn.TextColor3 = Color3.fromRGB(255, 255, 255)
- Btn.Font = Enum.Font.SourceSans
- Btn.TextSize = 18
- Btn.BorderSizePixel = 0
- Btn.MouseButton1Click:Connect(function()
- pcall(callback)
- end)
- end
- -- سلايدر
- function MartinUI:Slider(name, min, max, default, callback)
- local Holder = Instance.new("Frame", Scroller)
- Holder.Size = UDim2.new(1, -10, 0, 50)
- Holder.BackgroundTransparency = 1
- local Label = Instance.new("TextLabel", Holder)
- Label.Size = UDim2.new(1, 0, 0, 20)
- Label.Text = name .. ": " .. tostring(default)
- Label.TextColor3 = Color3.fromRGB(255, 255, 255)
- Label.Font = Enum.Font.SourceSans
- Label.TextSize = 18
- Label.BackgroundTransparency = 1
- local Slider = Instance.new("TextButton", Holder)
- Slider.Size = UDim2.new(1, 0, 0, 20)
- Slider.Position = UDim2.new(0, 0, 0, 25)
- Slider.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
- Slider.Text = ""
- Slider.BorderSizePixel = 0
- local Fill = Instance.new("Frame", Slider)
- Fill.Size = UDim2.new((default - min) / (max - min), 0, 1, 0)
- Fill.BackgroundColor3 = Color3.fromRGB(100, 100, 255)
- Fill.BorderSizePixel = 0
- local dragging = false
- Slider.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- end
- end)
- UserInputService.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = false
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
- local percent = math.clamp((input.Position.X - Slider.AbsolutePosition.X) / Slider.AbsoluteSize.X, 0, 1)
- local value = math.floor(min + (max - min) * percent)
- Fill.Size = UDim2.new(percent, 0, 1, 0)
- Label.Text = name .. ": " .. tostring(value)
- pcall(callback, value)
- end
- end)
- end
- -- TextBox
- function MartinUI:TextBox(placeholder, callback)
- local Box = Instance.new("TextBox", Scroller)
- Box.Size = UDim2.new(1, -10, 0, 40)
- Box.Text = ""
- Box.PlaceholderText = placeholder
- Box.Font = Enum.Font.SourceSans
- Box.TextSize = 18
- Box.TextColor3 = Color3.fromRGB(255, 255, 255)
- Box.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- Box.BorderSizePixel = 0
- Box.FocusLost:Connect(function()
- pcall(callback, Box.Text)
- end)
- end
- -- Dropdown
- function MartinUI:Dropdown(title, items, callback)
- local Holder = Instance.new("Frame", Scroller)
- Holder.Size = UDim2.new(1, -10, 0, 40 + (#items * 30))
- Holder.BackgroundTransparency = 1
- local Main = Instance.new("TextButton", Holder)
- Main.Size = UDim2.new(1, 0, 0, 40)
- Main.Text = title .. " ▼"
- Main.Font = Enum.Font.SourceSans
- Main.TextSize = 18
- Main.TextColor3 = Color3.fromRGB(255, 255, 255)
- Main.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- Main.BorderSizePixel = 0
- local Open = false
- for i, v in ipairs(items) do
- local Btn = Instance.new("TextButton", Holder)
- Btn.Size = UDim2.new(1, 0, 0, 30)
- Btn.Position = UDim2.new(0, 0, 0, 40 + (i - 1) * 30)
- Btn.Text = v
- Btn.Visible = false
- Btn.Font = Enum.Font.SourceSans
- Btn.TextSize = 16
- Btn.TextColor3 = Color3.fromRGB(255, 255, 255)
- Btn.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- Btn.BorderSizePixel = 0
- Btn.MouseButton1Click:Connect(function()
- Main.Text = title .. ": " .. v
- for _, btn in ipairs(Holder:GetChildren()) do
- if btn:IsA("TextButton") and btn ~= Main then
- btn.Visible = false
- end
- end
- Open = false
- pcall(callback, v)
- end)
- end
- Main.MouseButton1Click:Connect(function()
- Open = not Open
- for _, btn in ipairs(Holder:GetChildren()) do
- if btn:IsA("TextButton") and btn ~= Main then
- btn.Visible = Open
- end
- end
- end)
- end
- -- Notification
- function MartinUI:Notify(msg, time)
- local Note = Instance.new("TextLabel", MainFrame)
- Note.Size = UDim2.new(0, 300, 0, 30)
- Note.Position = UDim2.new(0.5, -150, 0, -40)
- Note.Text = msg
- Note.Font = Enum.Font.SourceSans
- Note.TextSize = 18
- Note.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
- Note.TextColor3 = Color3.fromRGB(255, 255, 255)
- Note.BorderSizePixel = 0
- TweenService:Create(Note, TweenInfo.new(0.4), {Position = UDim2.new(0.5, -150, 0, 10)}):Play()
- wait(time or 2)
- TweenService:Create(Note, TweenInfo.new(0.4), {Position = UDim2.new(0.5, -150, 0, -40)}):Play()
- wait(0.4)
- Note:Destroy()
- end
- return MartinUI
- end
- return MartinUI
Advertisement
Add Comment
Please, Sign In to add comment