Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local levimatlib = {}
- local mouse = game.Players.LocalPlayer:GetMouse()
- local ts = game:GetService("TweenService")
- function levimatlib:CreateGui(title, sizex, sizey, mainColor, accentColor)
- local gui = {}
- local Material = Instance.new("ScreenGui")
- local MainFrame = Instance.new("Frame")
- local DragFrame = Instance.new("Frame")
- local TitleFrame = Instance.new("Frame")
- local TextLabel = Instance.new("TextLabel")
- local Content = Instance.new("Frame")
- local UIGridLayout = Instance.new("UIGridLayout")
- Material.Name = "Material"
- Material.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- Material.ResetOnSpawn = false
- MainFrame.Name = "MainFrame"
- MainFrame.Parent = Material
- MainFrame.BackgroundColor3 = Color3.new(1, 1, 1)
- MainFrame.BackgroundTransparency = 1
- MainFrame.BorderSizePixel = 0
- MainFrame.ClipsDescendants = true
- MainFrame.Position = UDim2.new(0.25, 0, 0.25, 0)
- MainFrame.Size = UDim2.new(0, sizex, 0, sizey)
- MainFrame.AnchorPoint = Vector2.new(0.5,0.05)
- DragFrame.Name = "DragFrame"
- DragFrame.Parent = MainFrame
- DragFrame.BackgroundColor3 = accentColor
- DragFrame.BorderSizePixel = 0
- DragFrame.ClipsDescendants = true
- DragFrame.Size = UDim2.new(1, 0, 0, 10)
- TitleFrame.Name = "TitleFrame"
- TitleFrame.Parent = MainFrame
- TitleFrame.BackgroundColor3 = mainColor
- TitleFrame.BorderSizePixel = 0
- TitleFrame.ClipsDescendants = true
- TitleFrame.Position = UDim2.new(0, 0, 0, 10)
- TitleFrame.Size = UDim2.new(1, 0, 0, 40)
- TextLabel.Parent = TitleFrame
- TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel.BackgroundTransparency = 1
- TextLabel.Position = UDim2.new(0, 20, 0, 0)
- TextLabel.Size = UDim2.new(0, 150, 1, 0)
- TextLabel.Font = Enum.Font.SourceSans
- TextLabel.FontSize = Enum.FontSize.Size24
- TextLabel.Text = title
- TextLabel.TextColor3 = Color3.new(1, 1, 1)
- TextLabel.TextSize = 24
- TextLabel.TextStrokeColor3 = Color3.new(1, 1, 1)
- TextLabel.TextWrapped = true
- TextLabel.TextXAlignment = Enum.TextXAlignment.Left
- Content.Name = "Content"
- Content.Parent = MainFrame
- Content.BackgroundColor3 = Color3.new(1, 1, 1)
- Content.BorderSizePixel = 0
- Content.ClipsDescendants = true
- Content.Position = UDim2.new(0, 0, 0, 50)
- Content.Size = UDim2.new(1, 0, 1, -50)
- UIGridLayout.Parent = Content
- UIGridLayout.CellPadding = UDim2.new(0, 0, 0, 0)
- UIGridLayout.CellSize = UDim2.new(0, sizex/2, 0.2, 0)
- UIGridLayout.FillDirection = Enum.FillDirection.Vertical
- UIGridLayout.SortOrder = Enum.SortOrder.LayoutOrder
- local mouseondrag = false
- DragFrame.MouseEnter:connect(function()
- mouseondrag = true
- end)
- DragFrame.MouseLeave:connect(function()
- mouseondrag = false
- end)
- local mousedown = false
- mouse.Button1Down:connect(function()
- if mouseondrag == true then
- mousedown = true
- end
- end)
- mouse.Button1Up:connect(function()
- mousedown = false
- end)
- spawn(function()
- while true do
- if mousedown == true then
- local goal = UDim2.new(0, mouse.X, 0, mouse.Y)
- MainFrame:TweenPosition(goal, nil, Enum.EasingStyle.Sine, nil, 0.05)
- end
- wait(.1)
- end
- end)
- function gui:SetColor(newmainColor,newaccentColor)
- mainColor = newmainColor
- accentColor = newaccentColor
- TitleFrame.BackgroundColor3 = newmainColor
- DragFrame.BackgroundColor3 = newaccentColor
- local contents = Content:GetDescendants()
- for i=1,#contents do
- if contents[i].ClassName == "TextLabel" then
- contents[i].TextColor3 = newmainColor
- end
- if contents[i].ClassName == "TextButton" then
- contents[i].TextColor3 = newmainColor
- end
- if contents[i].ClassName == "TextBox" then
- contents[i].TextColor3 = newmainColor
- end
- if contents[i].Name == "Grabber" then
- contents[i].BackgroundColor3 = newmainColor
- contents[i].BorderColor3 = newaccentColor
- end
- if contents[i].Name == "SliderFill" then
- contents[i].BackgroundColor3 = newmainColor
- end
- if contents[i].Name == "Animation" then
- contents[i].BackgroundColor3 = newmainColor
- end
- end
- end
- local animation = Instance.new("Frame")
- animation.Name = "Animation"
- animation.AnchorPoint = Vector2.new(0.5,0.5)
- animation.BackgroundColor3 = accentColor
- animation.BackgroundTransparency = 0.6
- animation.BorderSizePixel = 0
- animation.Visible = false
- local tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
- local goal = {}
- goal.Size = UDim2.new(0, 0, 0, 0)
- local tween = ts:Create(animation, tweeninfo, goal)
- function gui:CreateAnimation(parent, mode)
- animation.Parent = parent
- tween:Cancel()
- if mode == 1 then
- goal.Size = UDim2.new(0, 0, 0, 0)
- goal.Transparency = 0.6
- animation.BackgroundTransparency = 0.6
- tween = ts:Create(animation, tweeninfo, goal)
- elseif mode == 2 then
- goal.Size = UDim2.new(0, 1000, 0, 1000)
- goal.Transparency = 1
- tween = ts:Create(animation, tweeninfo, goal)
- end
- local x = (mouse.X) - (parent.AbsolutePosition.X)
- local y = (mouse.Y) - (parent.AbsolutePosition.Y)
- animation.Position = UDim2.new(0, x, 0, y)
- animation.Size = UDim2.new(0, 50, 0, 50)
- animation.Visible = true
- tween:Play()
- end
- function gui:CreateButton(text, func)
- if func == nil then
- print("no func added!")
- else
- local ButtonHolder = Instance.new("Frame")
- local TextButton = Instance.new("TextButton")
- ButtonHolder.Name = "ButtonHolder"
- ButtonHolder.Parent = Content
- ButtonHolder.BackgroundColor3 = Color3.new(1, 1, 1)
- ButtonHolder.BackgroundTransparency = 1
- ButtonHolder.ClipsDescendants = true
- ButtonHolder.Position = UDim2.new(0, 0, 0.2, 0)
- ButtonHolder.Size = UDim2.new(0.5, 0, 0.2, 0)
- TextButton.Parent = ButtonHolder
- TextButton.BackgroundColor3 = Color3.new(0.941176, 0.941176, 0.941176)
- TextButton.BorderSizePixel = 0
- TextButton.ClipsDescendants = true
- TextButton.Position = UDim2.new(0.1, 0, 0.1, 0)
- TextButton.Size = UDim2.new(0.8, 0, 0.8, 0)
- TextButton.Font = Enum.Font.SourceSansBold
- TextButton.FontSize = Enum.FontSize.Size18
- TextButton.Text = text
- TextButton.TextColor3 = mainColor
- TextButton.TextSize = 16
- TextButton.MouseButton1Down:connect(function()
- gui:CreateAnimation(TextButton, 1)
- end)
- TextButton.MouseButton1Up:connect(function()
- func()
- gui:CreateAnimation(TextButton, 2)
- end)
- end
- end
- function gui:CreateCheckbox(text, defaultstate)
- if defaultstate == true then
- toggled = true
- else
- toggled = false
- end
- local CheckboxHolder = Instance.new("Frame")
- local CheckboxUnderline = Instance.new("Frame")
- local Label = Instance.new("TextLabel")
- local Checkbox = Instance.new("TextLabel")
- CheckboxHolder.Name = "CheckboxHolder"
- CheckboxHolder.Parent = Content
- CheckboxHolder.BackgroundColor3 = Color3.new(1, 1, 1)
- CheckboxHolder.BackgroundTransparency = 1
- CheckboxHolder.ClipsDescendants = true
- CheckboxHolder.Position = UDim2.new(0, 0, 0.8, 0)
- CheckboxHolder.Size = UDim2.new(0.5, 0, 0.2, 0)
- Label.Name = "Label"
- Label.Parent = CheckboxHolder
- Label.BackgroundColor3 = Color3.new(1, 1, 1)
- Label.BackgroundTransparency = 1
- Label.BorderSizePixel = 0
- Label.ClipsDescendants = true
- Label.Position = UDim2.new(0.1, 0, 0.1, 0)
- Label.Size = UDim2.new(0.8, 0, 0.8, 0)
- Label.Font = Enum.Font.SourceSansBold
- Label.FontSize = Enum.FontSize.Size18
- Label.Text = text
- Label.TextColor3 = mainColor
- Label.TextSize = 18
- Label.TextXAlignment = Enum.TextXAlignment.Left
- Checkbox.Name = "Checkbox"
- Checkbox.Parent = CheckboxHolder
- Checkbox.BackgroundColor3 = Color3.new(1, 1, 1)
- Checkbox.BorderColor3 = Color3.fromRGB(60, 60, 60)
- Checkbox.ClipsDescendants = true
- Checkbox.Position = UDim2.new(0.8, 0, 0.1, 0)
- Checkbox.Size = UDim2.new(0, 20, 0, 20)
- Checkbox.Font = Enum.Font.SourceSansBold
- Checkbox.FontSize = Enum.FontSize.Size18
- if toggled == true then
- Checkbox.Text = "✓"
- else
- Checkbox.Text = "X"
- end
- Checkbox.TextColor3 = mainColor
- Checkbox.TextScaled = true
- Checkbox.TextSize = 16
- Checkbox.TextWrapped = true
- local mouseoncheckbox = false
- Checkbox.MouseEnter:connect(function()
- mouseoncheckbox = true
- end)
- Checkbox.MouseLeave:connect(function()
- mouseoncheckbox = false
- end)
- mouse.Button1Down:connect(function()
- if mouseoncheckbox == true then
- gui:CreateAnimation(Checkbox, 1)
- end
- end)
- mouse.Button1Up:connect(function()
- if mouseoncheckbox == true then
- gui:CreateAnimation(Checkbox, 2)
- if toggled == true then
- toggled = false
- Checkbox.Text = "X"
- else
- toggled = true
- Checkbox.Text = "✓"
- end
- end
- end)
- local subfunction = {}
- function subfunction:GetValue()
- if toggled == true then
- return true
- else
- return false
- end
- end
- return subfunction
- end
- function gui:CreateTextbox(text)
- local TextboxHolder = Instance.new("Frame")
- local TextboxUnderline = Instance.new("Frame")
- local TextBox = Instance.new("TextBox")
- TextboxHolder.Name = "TextboxHolder"
- TextboxHolder.Parent = Content
- TextboxHolder.BackgroundColor3 = Color3.new(1, 1, 1)
- TextboxHolder.BackgroundTransparency = 1
- TextboxHolder.ClipsDescendants = true
- TextboxHolder.Position = UDim2.new(0, 0, 0.4, 0)
- TextboxHolder.Size = UDim2.new(0.5, 0, 0.2, 0)
- TextboxUnderline.Name = "TextboxUnderline"
- TextboxUnderline.Parent = TextboxHolder
- TextboxUnderline.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
- TextboxUnderline.BorderSizePixel = 0
- TextboxUnderline.ClipsDescendants = true
- TextboxUnderline.Position = UDim2.new(0.1, 0, 0.9, 0)
- TextboxUnderline.Size = UDim2.new(0.8, 0, 0, 1)
- TextBox.Parent = TextboxHolder
- TextBox.BackgroundColor3 = Color3.new(1, 1, 1)
- TextBox.BackgroundTransparency = 1
- TextBox.BorderSizePixel = 0
- TextBox.ClipsDescendants = true
- TextBox.Position = UDim2.new(0.1, 0, 0.1, 0)
- TextBox.Size = UDim2.new(0.8, 0, 0.8, 0)
- TextBox.Font = Enum.Font.SourceSansBold
- TextBox.FontSize = Enum.FontSize.Size18
- TextBox.TextColor3 = mainColor
- TextBox.TextSize = 18
- TextBox.TextXAlignment = Enum.TextXAlignment.Left
- TextBox.Text = text
- TextBox.Focused:connect(function()
- TextboxUnderline.BackgroundColor3 = mainColor
- end)
- TextBox.FocusLost:connect(function()
- TextboxUnderline.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
- end)
- local subfunction = {}
- function subfunction:GetText()
- return TextBox.Text
- end
- return subfunction
- end
- function gui:CreateSlider(defaultvalue)
- local value = 0
- if defaultvalue == nil or defaultvalue <= 0 then
- value = 0
- elseif defaultvalue >= 100 then
- value = 100
- else
- value = defaultvalue
- end
- local SliderHolder = Instance.new("Frame")
- local SliderBackground = Instance.new("Frame")
- local SliderFill = Instance.new("Frame")
- local Grabber = Instance.new("Frame")
- SliderHolder.Name = "SliderHolder"
- SliderHolder.Parent = Content
- SliderHolder.BackgroundColor3 = Color3.new(1, 1, 1)
- SliderHolder.BackgroundTransparency = 1
- SliderHolder.ClipsDescendants = true
- SliderHolder.Size = UDim2.new(0.5, 0, 0.2, 0)
- SliderBackground.Name = "SliderBackground"
- SliderBackground.Parent = SliderHolder
- SliderBackground.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
- SliderBackground.BorderSizePixel = 0
- SliderBackground.ClipsDescendants = true
- SliderBackground.Position = UDim2.new(0.1, 0, 0.5, 0)
- SliderBackground.Size = UDim2.new(0.8, 0, 0, 2)
- SliderFill.Name = "SliderFill"
- SliderFill.Parent = SliderHolder
- SliderFill.BackgroundColor3 = mainColor
- SliderFill.BorderSizePixel = 0
- SliderFill.ClipsDescendants = true
- SliderFill.Position = UDim2.new(0.1, 0, 0.5, 0)
- SliderFill.Size = UDim2.new(0, 0, 0, 2)
- SliderFill.ZIndex = 2
- local goal2 = UDim2.new(0, 150*(value/100), 0, 2)
- SliderFill:TweenSize(goal2, nil, Enum.EasingStyle.Sine, nil, 0.05)
- Grabber.Name = "Grabber"
- Grabber.Parent = SliderHolder
- Grabber.BackgroundColor3 = mainColor
- Grabber.BorderColor3 = accentColor
- Grabber.ClipsDescendants = true
- Grabber.AnchorPoint = Vector2.new(0.5,0.5)
- Grabber.Position = UDim2.new(0, 150*(value/100) + 25, 0.5, 0)
- Grabber.Size = UDim2.new(0, 10, 0, 10)
- Grabber.ZIndex = 3
- local mouseongrabber = false
- Grabber.MouseEnter:connect(function()
- mouseongrabber = true
- end)
- Grabber.MouseLeave:connect(function()
- mouseongrabber = false
- end)
- local dragginggrabber = false
- mouse.Button1Down:connect(function()
- if mouseongrabber == true then
- dragginggrabber = true
- end
- end)
- mouse.Button1Up:connect(function()
- dragginggrabber = false
- end)
- spawn(function()
- local thesizex = (sizex/2)-50
- while true do
- if Grabber.Position.X.Offset >= 178 then
- dragginggrabber = false
- Grabber:TweenPosition(UDim2.new(Grabber.Position.X.Scale, thesizex+25, Grabber.Position.Y.Scale, 0), 'Out', Enum.EasingStyle.Linear, 0.1, true)
- SliderFill:TweenSize(UDim2.new(0, 150, 0, 2), 'Out', Enum.EasingStyle.Linear, 0.1, true)
- end
- if Grabber.Position.X.Offset <= 22 then
- dragginggrabber = false
- Grabber:TweenPosition(UDim2.new(Grabber.Position.X.Scale, 25, Grabber.Position.Y.Scale, 0), 'Out', Enum.EasingStyle.Linear, 0.1, true)
- SliderFill:TweenSize(UDim2.new(0, 0, 0, 2), 'Out', Enum.EasingStyle.Linear, 0.1, true)
- end
- if dragginggrabber == true then
- local pos = (mouse.X) - (SliderHolder.AbsolutePosition.X)
- if pos <= 15 then
- pos = 25
- end
- if pos >= thesizex+35 then
- pos = thesizex+25
- end
- local goal = UDim2.new(0, pos, 0.5, 0)
- Grabber:TweenPosition(goal, 'Out', Enum.EasingStyle.Linear, 0.1, true)
- local goal2 = UDim2.new(0, pos-25, 0, 2)
- SliderFill:TweenSize(goal2, 'Out', Enum.EasingStyle.Linear, 0.1, true)
- end
- wait()
- end
- end)
- local subfunction = {}
- function subfunction:GetValue()
- if 0 >= SliderFill.Size.X.Offset/thesizex*50 then
- return 0
- else
- if SliderFill.Size.X.Offset/thesizex*100 >= 50 then
- return 100
- else
- return SliderFill.Size.X.Offset/thesizex*50
- end
- end
- end
- return subfunction
- end
- return gui
- end
- return levimatlib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement