Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gui = {}
- function percent(x,y) return UDim2.new(x/100,0,y/100,0) end function gui:percent(x,y) return percent(x,y) end
- function scale(x,y) return UDim2.new(x,0,y,0) end function gui:scale(x,y) return scale(x,y) end
- function pixels(x,y) return UDim2.new(0,x,0,y) end function gui:pixels(x,y) return pixels(x,y) end
- local recolor = "BackgroundColor3"
- function color(r,g,b)
- return Color3.fromRGB(r,g,b)
- end
- function gui:color(...) return color(...) end
- function gui:Frame()
- local f = Instance.new("Frame")
- f[recolor] = color(255,255,255)
- f.Size = pixels(0,0)
- f.BorderSizePixel = 0
- return f
- end
- function gui:RoundedFrame(color) -- game-specific
- -- Invisible Container Containing the round elements
- local f = gui:Frame()
- f.Name = "StyledFrame"
- f.Size = gui:pixels(150,150)
- f.BackgroundTransparency = 1
- local corners = {}
- -- Load Assets
- local corner = gui:ImageLabel("rbxgameasset://Images/roundcorner")
- corner.Name = "Corner"
- corners[1] = corner
- corners[2] = corner:Clone()
- corners[2].Rotation = 90
- corners[3] = corner:Clone()
- corners[3].Rotation = 270
- corners[4] = corner:Clone()
- corners[4].Rotation = 180
- corners[1].Parent = f
- corners[2].Parent = f
- corners[3].Parent = f
- corners[4].Parent = f
- local white = gui:Frame()
- white.Name = "Background"
- white.BackgroundColor3 = gui:color(255,255,255)
- white.BackgroundTransparency = 0
- local white2 = white:Clone()
- local white3 = white2:Clone()
- white.Parent = f
- white2.Parent = f
- white3.Parent = f
- local roundcontrol = {}
- --= Functions =--
- function roundcontrol.setTransparency(n) -- default: 0
- for _,image in pairs(corners) do
- image.ImageTransparency = n
- end
- white.BackgroundTransparency = n
- white2.BackgroundTransparency = n
- white3.BackgroundTransparency = n
- end
- function roundcontrol.setStyle(i) -- default: "rbxgameasset://Images/roundcorner"
- for _,image in pairs(corners) do
- image.Image = i
- end
- end
- function roundcontrol.setRoundSize(n) -- default: 25
- for _,image in pairs(corners) do
- image.Size = gui:pixels(n,n)
- end
- corners[2].Position = gui:percent(100,0) - gui:pixels(n,0)
- corners[3].Position = gui:percent(0,100) - gui:pixels(0,n)
- corners[4].Position = gui:percent(100,100) - gui:pixels(n,n)
- white.Size = gui:percent(100,100) - gui:pixels(0,n*2)
- white.Position = gui:pixels(0,n)
- white2.Size = gui:percent(100,0) + gui:pixels(-n*2,n)
- white2.Position = gui:pixels(n,0)
- white3.Size = gui:percent(100,0) + gui:pixels(-n*2,n)
- white3.Position = gui:percent(0,100) + gui:pixels(n,-n)
- end
- function roundcontrol.setColor(c) -- default: white
- for _,image in pairs(corners) do
- image.ImageColor3 = c
- end
- white.BackgroundColor3 = c
- white2.BackgroundColor3 = c
- white3.BackgroundColor3 = c
- end
- function roundcontrol.setLayer(c) -- default: 1
- for _,image in pairs(corners) do
- image.ZIndex = c
- end
- white.ZIndex = c
- white2.ZIndex = c
- white3.ZIndex = c
- end
- roundcontrol.setRoundSize(25)
- roundcontrol.setColor(color or gui:color(255,255,255))
- return {Frame=f,Functions=roundcontrol}
- end
- function gui:TextLabel()
- local f = Instance.new("TextLabel")
- f.Size = pixels(0,0)
- f.FontSize = "Size18"
- f.Font = "SourceSans"
- f.Text = ""
- f.TextColor3 = color(255,255,255)
- f.BorderSizePixel = 0
- return f
- end
- function gui:ImageLabel(i)
- local f = Instance.new("ImageLabel")
- f.Size = pixels(0,0)
- f.Image = i
- f.BackgroundTransparency = 1
- f.BorderSizePixel = 0
- return f
- end
- function gui:TextButton(click)
- local f = Instance.new("TextButton")
- f.Size = pixels(0,0)
- f.FontSize = "Size18"
- f.Font = "SourceSans"
- f.Text = ""
- f.TextColor3 = color(255,255,255)
- f.BorderSizePixel = 0
- if click then
- f.MouseButton1Click:connect(click)
- end
- return f
- end
- function gui:TextBox(change)
- local f = Instance.new("TextBox")
- f.Size = pixels(0,0)
- f.FontSize = "Size18"
- f.Font = "SourceSans"
- f.Text = ""
- f.TextColor3 = color(255,255,255)
- f.BorderSizePixel = 0
- if change then
- f.Changed:connect(function(property)
- if property == "Text" then
- change(f.Text)
- end
- end)
- end
- return f
- end
- function gui:Shadow(e)
- local f = gui:Frame()
- f[recolor] = color(0,0,0)
- f.Position = pixels(3,3)
- f.Size = percent(100,100)
- f.BackgroundTransparency = 50/100
- if e then
- e.ZIndex = e.ZIndex + 1
- f.Parent = e
- end
- return f
- end
- gui.Help = {}
- gui.Help.new = function(...)
- local t = {...} -- [action [, yoffset [, parent [, text] ] ] ]
- local fields = {}
- if t[2] then
- fields.y = t[2]
- end
- if t[4] then
- fields.text = t[4]
- end
- if t[3] then
- fields.parent = t[3]
- end
- if t[1] then
- fields.action = t[1]
- if fields.action == "text" then
- local l = gui:TextLabel()
- l.TextXAlignment = "Left"
- l.TextYAlignment = "Top"
- l.TextColor3 = gui:color(255,255,255)
- l.Parent = fields.parent -- or nil
- l.Text = fields.text or ""
- l.Position = gui:pixels(0,fields.y or 0)
- return l
- end
- if fields.action == "title" then
- local l = gui:TextLabel()
- l.TextXAlignment = "Left"
- l.TextYAlignment = "Top"
- l.FontSize = "Size42"
- l.TextColor3 = gui:color(255,255,255)
- l.Parent = fields.parent -- or nil
- l.Text = fields.text or ""
- l.Position = gui:pixels(0,fields.y or 0)
- return l
- end
- if fields.action == "separator" then
- local l = gui:Frame()
- l.Parent = fields.parent -- or nil
- l.Size = gui:scale(1,0) + gui:pixels(-8,2)
- l.BackgroundTransparency = 0.5
- l.Position = gui:pixels(4,fields.y or 0)
- return l
- end
- end
- end
- return gui
Advertisement
Add Comment
Please, Sign In to add comment