Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Library = {}
- function Library:CreateMain()
- local cc = Instance.new("ScreenGui")
- local UIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint")
- --Properties:
- cc.Name = "cc"
- cc.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- cc.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- UIAspectRatioConstraint.Parent = cc
- local main = Instance.new("Frame")
- main.Name = "main"
- main.Parent = cc
- main.BackgroundColor3 = Color3.new(0.117647, 0.117647, 0.117647)
- main.BorderColor3 = Color3.new(1, 1, 1)
- main.Position = UDim2.new(0.569850028, 0, 0.415950924, 0)
- main.Size = UDim2.new(0, 430, 0, 136)
- main.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton2 then
- 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 = cc.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)
- local GamerLibrary = {Content = {}}
- function GamerLibrary:NewSlider(tile, callback, max, min, startpoint)
- local fames = Instance.new("Frame")
- local famed = Instance.new("Frame")
- local TextLabel = Instance.new("TextLabel")
- fames.Name = "fames"
- fames.Parent = main
- fames.BackgroundColor3 = Color3.new(0.196078, 0.196078, 0.196078)
- fames.BorderColor3 = Color3.new(1, 1, 1)
- fames.Position = UDim2.new(0.0366352275, 0, 0.299019575, 0)
- fames.Size = UDim2.new(0, 397, 0, 54)
- famed.Name = "famed"
- famed.Parent = fames
- famed.BackgroundColor3 = Color3.new(0.254902, 0.254902, 0.254902)
- famed.BorderSizePixel = 0
- famed.Size = UDim2.new((startpoint or 0) / max, 0, 1, 0)
- TextLabel.Parent = fames
- TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel.BackgroundTransparency = 1
- TextLabel.BorderSizePixel = 0
- TextLabel.Position = UDim2.new(-0.000380816316, 0, 0, 0)
- TextLabel.Size = UDim2.new(0, 397, 0, 54)
- 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
- local dragging = false
- local function slide(input)
- local pos = UDim2.new(math.clamp((input.Position.X - fames.AbsolutePosition.X) / fames.AbsoluteSize.X, 0, 1), 0, 1, 0)
- famed: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;
- famed.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- end
- end)
- famed.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = false
- end
- end)
- famed.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