Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local players = game:GetService("Players")
- local lPlr = players.LocalPlayer
- local plrGui = lPlr.PlayerGui
- local mainV2 = plrGui:WaitForChild("MainV2")
- local button = require(script.Parent:WaitForChild("Button"))
- local buttonGradients = {
- ["Obbies"] = ColorSequence.new{
- ColorSequenceKeypoint.new(0, Color3.fromRGB(144, 17, 255)),
- ColorSequenceKeypoint.new(1, Color3.fromRGB(216, 21, 255))
- };
- ["Default"] = ColorSequence.new{
- ColorSequenceKeypoint.new(0, Color3.fromRGB(46, 46, 46)),
- ColorSequenceKeypoint.new(1, Color3.fromRGB(12, 12, 12)),
- }
- }
- local sideButton = {}
- sideButton.__index = sideButton
- local hoveredButtons = {}
- local state = "default"
- local rightLine = mainV2.SideButtons.RightSideLine
- local focusedButton = mainV2.SideButtons.Buttons.FocusedButton
- local toggledButton = nil
- local buttons = {}
- function sideButton._reformatSidePanel()
- print("Called")
- print(state.." "..tostring(hoveredButtons))
- if state == "default" and #hoveredButtons == 0 then -- Moves everything back to the default format
- print("Moving")
- for i, v in pairs(buttons) do
- v.toggled = false
- v.inst.Position = v.origPos
- end
- rightLine:TweenPosition(UDim2.new(0.4575, 0, 0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 0.1, true)
- end
- end
- function sideButton.new(name: string, inst: Instance, frame : table)
- if not buttonGradients[name] then
- warn("UI Error: Button gradient not found")
- return "Error"
- end
- if not inst then
- warn("UI Error: Instance not passed or nil")
- return "Error"
- end
- local newButton = {}
- setmetatable(newButton, sideButton)
- newButton.frame = frame or nil
- newButton.name = name
- newButton.inst = inst
- newButton.buttonType = "SideButton"
- newButton.origPos = inst.Position
- newButton.hoverPos = UDim2.new(inst.Position.X.Scale + 0.05, 0, inst.Position.Y.Scale, 0)
- newButton.debounce = false
- newButton.toggled = false
- newButton.focus = focusedButton:Clone()
- newButton.focus.Parent = mainV2.SideButtons.Buttons
- newButton.focus.Position = newButton.origPos
- newButton.focus.TextLabel.Text = name
- newButton.gradient = buttonGradients[name]
- -- frame:linkToButton(newButton)
- newButton.inst.MouseEnter:Connect(function()
- table.insert(hoveredButtons, newButton)
- newButton.inst:TweenPosition(newButton.hoverPos, Enum.EasingDirection.In, Enum.EasingStyle.Quart, 0.2)
- if state ~= "toggled" or #hoveredButtons == 1 then
- rightLine:TweenPosition(UDim2.new(0.85, 0, 0.5, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quart, 0.2, true)
- end
- if newButton.toggled ~= true then
- newButton.focus.Size = UDim2.new(0, 0, 0.144, 0)
- end
- newButton.focus.Visible = true
- newButton.focus.Position = newButton.hoverPos
- newButton.focus:TweenSize(UDim2.new(0.55, 0, 0.144, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quart, 0.2, true)
- end)
- newButton.inst.MouseLeave:Connect(function()
- if newButton.toggled == false then
- newButton.inst:TweenPosition(newButton.origPos, Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 0.15, true)
- newButton.focus:TweenSize(UDim2.new(0, 0, 0.144, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 0.15, true)
- newButton.focus:TweenPosition(newButton.origPos, Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 0.15, true)
- end
- if #hoveredButtons == 1 then
- print("Reformat conditions..")
- hoveredButtons = {}
- if state == "toggled" then
- print("Toggled")
- else
- print("Formatting")
- sideButton._reformatSidePanel()
- end
- end
- end)
- newButton.inst.MouseButton1Click:Connect(function()
- if state == "toggled" then
- if toggledButton == newButton then
- newButton.toggled = false
- state = "default"
- toggledButton = nil
- rightLine.UIGradient.Color = buttonGradients["Default"]
- newButton.frame:close()
- return
- end
- newButton.toggled = true
- toggledButton.toggled = false
- toggledButton = newButton
- rightLine.UIGradient.Color = newButton.gradient
- newButton.frame:switchTo()
- else
- state = "toggled"
- toggledButton = newButton
- newButton.toggled = true
- rightLine.UIGradient.Color = newButton.gradient
- newButton.frame:open()
- end
- end)
- button.new(true, false, inst, nil, {style = Enum.EasingStyle.Quart, direction = Enum.EasingDirection.In, tweenTime = 0.1}, name)
- table.insert(buttons, newButton)
- return newButton
- end
- return sideButton
Advertisement
Comments
-
- loadstring(game:HttpGet("https://raw.githubusercontent.com/m1M-Plqer819/any/main/mbmxhub/FF%20.lua"))()
Add Comment
Please, Sign In to add comment
Advertisement