Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- - HOW TO USE:
- first line:
- local library = loadstring(game:HttpGet('https://pastebin.com/raw/mwSUiuAD'))()
- local frame = library.create_frame('framename', 5) -- the argument_2(fitsize) is how much textlabels + text buttons can fit in the frame.
- local textlabel1 = frame.add_textlabel("zq's test ui library") -- btw, this function returns the textlabel you create
- local textbutton1 = frame.add_textbutton("print a msg", function() print("testing") game:GetService("StarterGui") end) -- the second argument will be the function onclick, this funtion also returns the textbutton you create
- ]]
- local library = {}
- local frames = {}
- local close_bind_key = Enum.KeyCode.RightShift
- local close_bind_bool = true
- local base = Instance.new("ScreenGui")
- base.Parent=game:GetService("CoreGui")
- base.Name = "zq's library."
- function library.create_frame(frame_name, fitsize) -- the argument_2(fitsize) is how much textlabels + text buttons can fit in the frame.
- local frame_library = {}
- table.insert(frames, frame_library)
- local count = 0
- local frame = Instance.new("Frame")
- frame.Parent=base
- frame.Name=frame_name
- frame.Active = true
- frame.Draggable = true
- frame.BackgroundColor3=Color3.new(0.0980392, 0.0980392, 0.0980392)
- coroutine.resume(coroutine.create(function()
- local fitcount = 0
- for i = 1, fitsize, 1 do
- fitcount+=0.05
- end
- frame.Size=UDim2.new(0.128, 0, fitcount, 0)
- end))
- local listlayout = Instance.new("UIListLayout")
- listlayout.Parent=frame
- function frame_library.getframe()
- return frame
- end
- function frame_library.add_textlabel(text)
- if count<fitsize then
- count+=1
- local textlabel = Instance.new("TextLabel")
- textlabel.Parent=frame
- textlabel.Size=UDim2.new(1, 0, frame.Size.Y.Scale/4, 0)
- textlabel.BackgroundTransparency=Color3.new(0.2, 0.2, 0.2)
- textlabel.TextScaled=true
- textlabel.Font = Enum.Font.ArialBold
- textlabel.Text = text
- textlabel.TextColor3=Color3.new(0.501961, 0.999969, 0.0310369)
- return textlabel
- else
- game:GetService('CoreGui'):SetCore("SendNotification", {
- Title = 'Error!';
- Text = 'count<fitsize, new textlabel denied';
- Duration = 15;
- })
- end
- return false
- end
- function frame_library.add_textbutton(text, func)
- if count<fitsize then
- count+=1
- local textbutton = Instance.new("TextButton")
- textbutton.Parent=frame
- textbutton.Size=UDim2.new(1, 0, frame.Size.Y.Scale/4, 0)
- textbutton.BackgroundTransparency=Color3.new(0.2, 0.2, 0.2)
- textbutton.TextScaled=true
- textbutton.Font = Enum.Font.ArialBold
- textbutton.Text = text
- textbutton.TextColor3=Color3.new(0.701961, 0.701961, 0.701961)
- if func then
- textbutton.MouseButton1Click:Connect(func)
- end
- return textbutton
- else
- game:GetService('CoreGui'):SetCore("SendNotification", {
- Title = 'Error!';
- Text = 'count<fitsize, new textbutton denied';
- Duration = 15;
- })
- end
- end
- return frame_library
- end
- function library.getallframes()
- return frames
- end
- function library.bindtoclose(bool, keybind) -- keybind has to be a enum. Like, Enum.KeyCode.E, Enum.KeyCode.RightShift
- if bool == true then
- close_bind_bool = true
- close_bind_key = keybind
- else
- close_bind_bool = false
- end
- end
- game:GetService("UserInputService").InputBegan:Connect(function(inp, gps)
- if inp.KeyCode==close_bind_key and close_bind_bool==true then
- for _, v in pairs(frames) do
- local rframe = v.getframe()
- rframe.Visible = not rframe.Visible
- end
- end
- end)
- return library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement