Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Library = {}
- function Library:CreateMain()
- local ScreenGui = Instance.new("ScreenGui")
- local main = Instance.new("Frame")
- local backgroup = Instance.new("Frame")
- local UIListLayout = Instance.new("UIListLayout")
- local tile = Instance.new("TextLabel")
- local UIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint")
- local dragging = false
- local draggableStart
- local startPos
- ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- UIAspectRatioConstraint.Parent = ScreenGui
- main.Name = "main"
- main.Parent = ScreenGui
- main.BackgroundColor3 = Color3.new(0.117647, 0.117647, 0.117647)
- main.BorderColor3 = Color3.new(1, 1, 1)
- main.Position = UDim2.new(0.588792443, 0, 0.381595075, 0)
- main.Size = UDim2.new(0, 250, 0, 38)
- main.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton2 then
- if not main.Visible then
- elseif main.Visible then
- end;
- elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- draggableStart = input.Position
- startPos = main.AbsolutePosition
- elseif input.UserInputType == Enum.UserInputType.MouseMovement then
- game:GetService("TweenService"):Create(main, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(25, 25, 25)}):Play()
- end
- end)
- main.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = false
- elseif input.UserInputType == Enum.UserInputType.MouseMovement then
- game:GetService("TweenService"):Create(main, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB(30, 30, 30)}):Play()
- end
- end)
- game:GetService("UserInputService").InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
- local res = ScreenGui.AbsoluteSize
- main.Position = UDim2.new((startPos.X / res.X) + ((input.Position.X / res.X) - (draggableStart.X / res.X)), 0, (startPos.Y / res.Y) + ((input.Position.Y / res.Y) - (draggableStart.Y / res.Y)), 0)
- end
- end)
- tile.Name = "tile"
- tile.Parent = main
- tile.BackgroundColor3 = Color3.new(1, 1, 1)
- tile.BackgroundTransparency = 1
- tile.Size = UDim2.new(0, 250, 0, 38)
- tile.Font = Enum.Font.SourceSans
- tile.Text = "Không Biết Làm Uilib"
- tile.TextColor3 = Color3.new(1, 1, 1)
- tile.TextScaled = true
- tile.TextSize = 14
- tile.TextWrapped = true
- local GamerLibrary = {}
- backgroup.Name = "backgroup"
- backgroup.Parent = main
- backgroup.BackgroundColor3 = Color3.new(0.117647, 0.117647, 0.117647)
- backgroup.BorderColor3 = Color3.new(1, 1, 1)
- backgroup.Position = UDim2.new(0, 0, 1, 0)
- backgroup.Size = UDim2.new(0, 250, 0, 181)
- UIListLayout.Parent = backgroup
- UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
- function GamerLibrary:NewSlider(tile, callback, max, min, startpoint)
- local framr = Instance.new("Frame")
- local framn = Instance.new("Frame")
- local TextLabel = Instance.new("TextLabel")
- framr.Name = "framr"
- framr.Parent = backgroup
- framr.BackgroundColor3 = Color3.new(0.196078, 0.196078, 0.196078)
- framr.BorderColor3 = Color3.new(1, 1, 1)
- framr.Position = UDim2.new(0.0560000017, 0, 0.0718232021, 0)
- framr.Size = UDim2.new(0, 222, 0, 36)
- framn.Name = "framn"
- framn.Parent = framr
- framn.BackgroundColor3 = Color3.new(0.235294, 0.235294, 0.235294)
- framn.BorderSizePixel = 0
- framn.Size = UDim2.new((startpoint or 0) / max, 0, 0, 36)
- TextLabel.Parent = framr
- TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel.BackgroundTransparency = 1
- TextLabel.Size = UDim2.new(0, 222, 0, 36)
- TextLabel.Font = Enum.Font.SourceSans
- TextLabel.Text = tile .. tostring(startpoint and math.floor((startpoint / max) * (max - min) + min) or 0)
- TextLabel.TextColor3 = Color3.new(1, 1, 1)
- TextLabel.TextScaled = true
- TextLabel.TextSize = 14
- TextLabel.TextWrapped = true
- TextLabel.TextXAlignment = Enum.TextXAlignment.Left
- local dragging = false
- local function slide(input)
- local pos = UDim2.new(math.clamp((input.Position.X - framr.AbsolutePosition.X) / framr.AbsoluteSize.X, 0, 1), 0, 1, 0)
- framn:TweenSize(pos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
- local value = math.floor(((pos.X.Scale * max) / max) * (max - min) + min)
- TextLabel.Text = tile .. tostring(value)
- callback(value)
- end;
- framr.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- end
- end)
- framr.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = false
- end
- end)
- framr.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- slide(input)
- end
- end)
- game:GetService("UserInputService").InputChanged:Connect(function(input)
- if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
- slide(input)
- end
- end)
- end
- return GamerLibrary
- end
- return Library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement