Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Martin UI: Wind+Luna mix, blue->purple gradient accent
- local TweenService = game:GetService("TweenService")
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local LocalPlayer = Players.LocalPlayer
- local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
- local UI = {}
- UI._windows = {}
- local Defaults = {
- AccentStart = Color3.fromRGB(73, 137, 255),
- AccentEnd = Color3.fromRGB(156, 68, 255),
- Background = Color3.fromRGB(12,12,12),
- Card = Color3.fromRGB(18,18,18),
- Text = Color3.fromRGB(230,230,230),
- Shadow = Color3.fromRGB(0,0,0),
- Corner = UDim.new(0,6)
- }
- local function new(name,props)
- local obj = Instance.new(name)
- for k,v in pairs(props or {}) do
- obj[k] = v
- end
- return obj
- end
- local function makeUICorner(parent, radius)
- local c = new("UICorner",{CornerRadius = radius or Defaults.Corner})
- c.Parent = parent
- return c
- end
- local function makeShadow(parent)
- local e = new("UIStroke",{ApplyStrokeMode = Enum.ApplyStrokeMode.Border,Thickness = 0.6,Transparency = 0.6})
- e.Parent = parent
- return e
- end
- local function tween(obj, props, time, style, dir)
- local info = TweenInfo.new(time or 0.2, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out)
- local t = TweenService:Create(obj, info, props)
- t:Play()
- return t
- end
- local function addDrag(frame, dragHandle)
- dragHandle = dragHandle or frame
- local dragging, dragInput, dragStart, startPos
- dragHandle.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- dragging = true
- dragStart = input.Position
- startPos = frame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- dragHandle.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
- dragInput = input
- end
- end)
- game:GetService("UserInputService").InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- local delta = input.Position - dragStart
- frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- end)
- end
- local function createGradient(frame)
- local g = new("UIGradient",{})
- g.Color = ColorSequence.new(Defaults.AccentStart, Defaults.AccentEnd)
- g.Rotation = 30
- g.Parent = frame
- return g
- end
- local function makeButton(parent,text,callback)
- local btn = new("TextButton",{Text = text,Size = UDim2.new(1,0,0,36),BackgroundTransparency=0,BackgroundColor3=Defaults.Card,TextColor3=Defaults.Text,BorderSizePixel=0,Font=Enum.Font.GothamBold,TextSize=14,AutoButtonColor=false})
- makeUICorner(btn)
- makeShadow(btn)
- btn.MouseEnter:Connect(function()
- tween(btn,{BackgroundTransparency=0.1},0.18)
- end)
- btn.MouseLeave:Connect(function()
- tween(btn,{BackgroundTransparency=0},0.18)
- end)
- btn.MouseButton1Click:Connect(function()
- tween(btn,{BackgroundTransparency=0.2},0.06,nil,Enum.EasingDirection.In)
- wait(0.06)
- tween(btn,{BackgroundTransparency=0},0.12)
- pcall(callback)
- end)
- btn.Parent = parent
- return btn
- end
- local function makeLabel(parent,txt,size)
- local l = new("TextLabel",{Text=txt,Size=size or UDim2.new(1,0,0,20),BackgroundTransparency=1,TextColor3=Defaults.Text,Font=Enum.Font.Gotham,TextSize=14,TextXAlignment=Enum.TextXAlignment.Left})
- l.Parent = parent
- return l
- end
- local function createToggle(parent,label,default,callback)
- local frame = new("Frame",{Size=UDim2.new(1,0,0,36),BackgroundTransparency=1})
- local lbl = makeLabel(frame,label,UDim2.new(0.7,0,1,0))
- lbl.Position = UDim2.new(0,0,0,8)
- local box = new("Frame",{Size=UDim2.new(0,0,0,24),Position=UDim2.new(1,-34,0,6),BackgroundColor3=Defaults.Card,BorderSizePixel=0})
- makeUICorner(box,UDim.new(0,14))
- box.Parent = frame
- local dot = new("Frame",{Size=UDim2.new(0,0,0,18),Position=UDim2.new(0,3,0,3),BackgroundColor3=Defaults.Background,BorderSizePixel=0})
- makeUICorner(dot,UDim.new(0,10))
- dot.Parent = box
- local toggled = default or false
- local function refresh()
- if toggled then
- tween(box,{Size=UDim2.new(0,50,0,24)},0.18)
- tween(dot,{Position=UDim2.new(1,-21,0,3)},0.18)
- createGradient(box)
- else
- tween(box,{Size=UDim2.new(0,34,0,24)},0.18)
- tween(dot,{Position=UDim2.new(0,3,0,3)},0.18)
- for _,v in pairs(box:GetChildren()) do if v:IsA("UIGradient") then v:Destroy() end end
- end
- end
- frame.InputBegan:Connect(function(input)
- if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then
- toggled = not toggled
- refresh()
- pcall(callback,toggled)
- end
- end)
- refresh()
- frame.Parent = parent
- return frame
- end
- local function createSlider(parent,label,min,max,default,callback)
- local frame = new("Frame",{Size=UDim2.new(1,0,0,48),BackgroundTransparency=1})
- local lbl = makeLabel(frame,label,UDim2.new(1,0,0,18))
- lbl.Position = UDim2.new(0,0,0,0)
- local bar = new("Frame",{Size=UDim2.new(1,0,0,12),Position=UDim2.new(0,0,0,28),BackgroundColor3=Color3.fromRGB(40,40,40),BorderSizePixel=0})
- makeUICorner(bar,UDim.new(0,6))
- bar.Parent = frame
- local fill = new("Frame",{Size=UDim2.new(0,0,0,12),BackgroundColor3=Defaults.Card,BorderSizePixel=0})
- makeUICorner(fill,UDim.new(0,6))
- fill.Parent = bar
- createGradient(fill)
- local handle = new("ImageLabel",{Size=UDim2.new(0,0,0,18),Position=UDim2.new(0,0,0,-3),BackgroundColor3=Defaults.Card,BorderSizePixel=0,Image=""})
- makeUICorner(handle,UDim.new(0,20))
- handle.Parent = bar
- local dragging = false
- local function setFromX(x)
- local rel = math.clamp((x - bar.AbsolutePosition.X)/bar.AbsoluteSize.X,0,1)
- local val = min + (max-min) * rel
- fill.Size = UDim2.new(rel,0,1,0)
- handle.Position = UDim2.new(rel,0,0,-3)
- pcall(callback,math.floor(val*100)/100)
- end
- handle.InputBegan:Connect(function(input)
- if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then
- dragging = true
- end
- end)
- handle.InputEnded:Connect(function(input)
- if input.UserInputState==Enum.UserInputState.End then dragging = false end
- end)
- game:GetService("UserInputService").InputChanged:Connect(function(input)
- if dragging and (input.UserInputType==Enum.UserInputType.MouseMovement or input.UserInputType==Enum.UserInputType.Touch) then
- setFromX(input.Position.X)
- end
- end)
- bar.InputBegan:Connect(function(input)
- if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then
- setFromX(input.Position.X)
- end
- end)
- frame.Parent = parent
- if default then
- local rel = math.clamp((default-min)/(max-min),0,1)
- fill.Size = UDim2.new(rel,0,1,0)
- handle.Position = UDim2.new(rel,0,0,-3)
- end
- return frame
- end
- local function createTextBox(parent,placeholder,callback)
- local frame = new("Frame",{Size=UDim2.new(1,0,0,40),BackgroundTransparency=1})
- local box = new("TextBox",{Size=UDim2.new(1,0,0,36),BackgroundColor3=Defaults.Card,TextColor3=Defaults.Text,Text=placeholder,PlaceholderText=placeholder,ClearTextOnFocus=false,Font=Enum.Font.Gotham,TextSize=14,BorderSizePixel=0})
- makeUICorner(box)
- box.Parent = frame
- box.Focused:Connect(function()
- if box.Text == placeholder then box.Text = "" end
- end)
- box.FocusLost:Connect(function(enter)
- pcall(callback,box.Text,enter)
- end)
- frame.Parent = parent
- return frame, box
- end
- local function createDropdown(parent,label,options,callback)
- local frame = new("Frame",{Size=UDim2.new(1,0,0,36),BackgroundTransparency=1})
- local lbl = makeLabel(frame,label,UDim2.new(0.6,0,1,0))
- lbl.Position = UDim2.new(0,0,0,8)
- local box = new("TextButton",{Size=UDim2.new(1,0,0,36),BackgroundColor3=Defaults.Card,Text=options[1] or "Select",TextColor3=Defaults.Text,BorderSizePixel=0,TextXAlignment=Enum.TextXAlignment.Left,Font=Enum.Font.Gotham,TextSize=14})
- makeUICorner(box)
- box.Parent = frame
- local list = new("Frame",{Size=UDim2.new(1,0,0,0),Position=UDim2.new(0,0,0,36),BackgroundColor3=Defaults.Card,ClipsDescendants=true})
- makeUICorner(list)
- list.Parent = frame
- local layout = new("UIListLayout",{Padding=UDim.new(0,4),SortOrder=Enum.SortOrder.LayoutOrder})
- layout.Parent = list
- local open = false
- local function build()
- for i,opt in pairs(options) do
- local btn = new("TextButton",{Text=opt,Size=UDim2.new(1,0,0,32),BackgroundTransparency=1,TextColor3=Defaults.Text,Font=Enum.Font.Gotham,TextSize=14,BorderSizePixel=0})
- btn.Parent = list
- btn.MouseButton1Click:Connect(function()
- box.Text = opt
- open = false
- tween(list,{Size=UDim2.new(1,0,0,0)},0.18)
- pcall(callback,opt)
- wait(0.2)
- for _,v in pairs(list:GetChildren()) do if v:IsA("TextButton") then v:Destroy() end end
- end)
- end
- end
- box.MouseButton1Click:Connect(function()
- if open then
- tween(list,{Size=UDim2.new(1,0,0,0)},0.18)
- open = false
- wait(0.18)
- for _,v in pairs(list:GetChildren()) do if v:IsA("TextButton") then v:Destroy() end end
- else
- build()
- local h = math.clamp(#options * 36, 36, 180)
- tween(list,{Size=UDim2.new(1,0,0,h)},0.18)
- open = true
- end
- end)
- frame.Parent = parent
- return frame
- end
- local function notify(title,msg,timeout)
- local gui = PlayerGui:FindFirstChild("MartinUI_Notifications") or new("ScreenGui",{Name="MartinUI_Notifications",Parent=PlayerGui,ResetOnSpawn=false})
- local container = gui:FindFirstChild("Container") or new("Frame",{Name="Container",Size=UDim2.new(0,300,0,0),Position=UDim2.new(1,-320,0,0),BackgroundTransparency=1,Parent=gui})
- container.ClipsDescendants = true
- container.Parent = gui
- local card = new("Frame",{Size=UDim2.new(1,0,0,72),BackgroundColor3=Defaults.Card,AnchorPoint=Vector2.new(1,0),Position=UDim2.new(1,0,0,0),BorderSizePixel=0})
- makeUICorner(card)
- card.Parent = container
- local titleLbl = new("TextLabel",{Text=title,Size=UDim2.new(1,0,0,20),Position=UDim2.new(0,8,0,8),BackgroundTransparency=1,TextColor3=Defaults.Text,Font=Enum.Font.GothamBold,TextSize=14,TextXAlignment=Enum.TextXAlignment.Left})
- titleLbl.Parent = card
- local msgLbl = new("TextLabel",{Text=msg,Size=UDim2.new(1,-16,0,36),Position=UDim2.new(0,8,0,28),BackgroundTransparency=1,TextColor3=Defaults.Text,Font=Enum.Font.Gotham,TextSize=13,TextWrapped=true,TextXAlignment=Enum.TextXAlignment.Left})
- msgLbl.Parent = card
- local h = container.Size.Y.Offset + 84
- tween(container,{Size=UDim2.new(0,300,0,h)},0.18)
- tween(card,{Position=UDim2.new(1,0,0,container.Size.Y.Offset)},0.28)
- spawn(function()
- wait(timeout or 4)
- tween(card,{Position=UDim2.new(1,0,0,container.Size.Y.Offset+84)},0.22)
- wait(0.22)
- tween(container,{Size=UDim2.new(0,300,0,container.Size.Y.Offset-84)},0.18)
- wait(0.18)
- card:Destroy()
- end)
- end
- function UI:CreateWindow(title,options)
- local opts = options or {}
- local screen = new("ScreenGui",{Name = "MartinUI_Main"..title,Parent = PlayerGui,ResetOnSpawn=false})
- local main = new("Frame",{Size = UDim2.new(0,640,0,420),Position = UDim2.new(0.5,-320,0.5,-210),AnchorPoint = Vector2.new(0.5,0.5),BackgroundColor3 = Defaults.Background,BorderSizePixel=0})
- makeUICorner(main,UDim.new(0,12))
- main.Parent = screen
- local shadow = makeShadow(main)
- local left = new("Frame",{Size=UDim2.new(0,160,1,0),Position=UDim2.new(0,0,0,0),BackgroundColor3=Color3.fromRGB(14,14,14),BorderSizePixel=0,Parent=main})
- makeUICorner(left)
- local right = new("Frame",{Size=UDim2.new(1,0,1,0),Position=UDim2.new(0,160,0,0),BackgroundTransparency=1,Parent=main})
- local header = new("Frame",{Size=UDim2.new(1,0,0,44),Position=UDim2.new(0,0,0,0),BackgroundTransparency=1,Parent=right})
- local titleLbl = new("TextLabel",{Text=title,Size=UDim2.new(1,0,0,36),Position=UDim2.new(0,12,0,4),BackgroundTransparency=1,TextColor3=Defaults.Text,Font=Enum.Font.GothamBold,TextSize=18,TextXAlignment=Enum.TextXAlignment.Left})
- titleLbl.Parent = header
- local topButtons = new("Frame",{Size=UDim2.new(0.3,0,1,0),Position=UDim2.new(0.7,0,0,0),BackgroundTransparency=1,Parent=header})
- local closeBtn = new("TextButton",{Text="✕",Size=UDim2.new(0,36,0,36),Position=UDim2.new(1,-44,0,4),BackgroundTransparency=0,BackgroundColor3=Defaults.Card,Font=Enum.Font.GothamBold,TextColor3=Defaults.Text,BorderSizePixel=0})
- makeUICorner(closeBtn,UDim.new(0,10))
- closeBtn.Parent = header
- closeBtn.MouseButton1Click:Connect(function()
- tween(main,{Size=UDim2.new(0,0,0,0),Position=UDim2.new(0.5,0,0.5,0)},0.28)
- wait(0.28)
- screen:Destroy()
- end)
- local sidebarLayout = new("UIListLayout",{Padding=UDim.new(0,8),SortOrder=Enum.SortOrder.LayoutOrder,Parent=left})
- sidebarLayout.Padding = UDim.new(0,12)
- local profile = new("Frame",{Size=UDim2.new(1,0,0,96),BackgroundTransparency=1,Parent=left})
- local avatar = new("ImageLabel",{Size=UDim2.new(0,64,0,64),Position=UDim2.new(0.5,-32,0,12),BackgroundColor3=Defaults.Card,BorderSizePixel=0})
- makeUICorner(avatar,UDim.new(0,16))
- avatar.Parent = profile
- local nameLbl = new("TextLabel",{Text=LocalPlayer.Name,Size=UDim2.new(1,0,0,20),Position=UDim2.new(0,0,0,76),BackgroundTransparency=1,TextColor3=Defaults.Text,Font=Enum.Font.GothamBold,TextSize=14,TextXAlignment=Enum.TextXAlignment.Center})
- nameLbl.Parent = profile
- local tabsContainer = new("Frame",{Size=UDim2.new(1,0,0,180),BackgroundTransparency=1,Parent=left})
- local tabsLayout = new("UIListLayout",{Padding=UDim.new(0,6),SortOrder=Enum.SortOrder.LayoutOrder,Parent=tabsContainer})
- local pagesParent = new("Frame",{Size=UDim2.new(1,0,1, -44),Position=UDim2.new(0,0,0,44),BackgroundTransparency=1,Parent=right})
- pagesParent.ClipsDescendants = true
- local pages = {}
- local currentPage = nil
- local function createTab(name)
- local btn = new("TextButton",{Text=name,Size=UDim2.new(1,0,0,36),BackgroundTransparency=1,TextColor3=Defaults.Text,Font=Enum.Font.Gotham,TextSize=14,BorderSizePixel=0})
- btn.Parent = tabsContainer
- local page = new("Frame",{Size=UDim2.new(1,0,1,0),BackgroundTransparency=1,Visible=false,Parent=pagesParent})
- local layout = new("UIPadding",{PaddingTop=UDim.new(0,8),Parent=page})
- page.LayoutOrder = #pages + 1
- pages[name] = {Page = page, Button = btn}
- btn.MouseButton1Click:Connect(function()
- if currentPage and currentPage ~= page then currentPage.Visible = false end
- page.Visible = true
- currentPage = page
- end)
- return pages[name]
- end
- addDrag(main,header)
- main.Parent = screen
- local window = {
- Screen = screen,
- Main = main,
- CreateTab = function(self,name)
- local t = createTab(name)
- local tabAPI = {}
- function tabAPI:CreateButton(text,fn)
- local section = new("Frame",{Size=UDim2.new(1,0,0,44),BackgroundTransparency=1})
- section.Parent = t.Page
- makeButton(section,text,fn)
- return section
- end
- function tabAPI:CreateToggle(text,def,fn)
- return createToggle(t.Page,text,def,fn)
- end
- function tabAPI:CreateSlider(text,min,max,def,fn)
- return createSlider(t.Page,text,min,max,def,fn)
- end
- function tabAPI:CreateTextBox(placeholder,fn)
- return createTextBox(t.Page,placeholder,fn)
- end
- function tabAPI:CreateDropdown(text,options,fn)
- return createDropdown(t.Page,text,options,fn)
- end
- function tabAPI:CreateLabel(text)
- local l = makeLabel(t.Page,text,UDim2.new(1,0,0,20))
- return l
- end
- return tabAPI
- end,
- Notify = function(self,title,msg,timeout) notify(title,msg,timeout) end,
- Open = function(self)
- main.Size = UDim2.new(0,0,0,0)
- main.Position = UDim2.new(0.5,0,0.5,0)
- tween(main,{Size=UDim2.new(0,640,0,420),Position=UDim2.new(0.5,-320,0.5,-210)},0.28,Enum.EasingStyle.Cubic)
- end,
- Close = function(self)
- tween(main,{Size=UDim2.new(0,0,0,0),Position=UDim2.new(0.5,0,0.5,0)},0.28)
- wait(0.28)
- if screen then screen:Destroy() end
- end
- }
- table.insert(UI._windows,window)
- return window
- end
- return UI
Advertisement
Add Comment
Please, Sign In to add comment