local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")

local LocalPlayer = Players.LocalPlayer
local player = LocalPlayer
local Mouse = LocalPlayer:GetMouse()

local AutoDupe = false
local Cooldown = false
local dupeTask = nil
local AutoBuyBagElite = false

--// Helpers
local function checkgun()
    local char = LocalPlayer.Character
    if not char then return nil end
    local tool = char:FindFirstChildOfClass("Tool")
    if tool and tool:FindFirstChild("GunScript_Server") then
        return tool
    end
    return nil
end

local function findProximityPromptRecursive(obj)
    if obj:IsA("ProximityPrompt") then return obj end
    for _, child in pairs(obj:GetChildren()) do
        local prompt = findProximityPromptRecursive(child)
        if prompt then return prompt end
    end
    return nil
end

local function StartLoop()
	AutoDupe = true
	local FirstTool = nil
	
	repeat
		task.wait(0.5)
		FirstTool = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Tool")
	until FirstTool or not AutoDupe
	
	if not AutoDupe or not FirstTool then
		AutoDupe = false
		return
	end
	
	local ToolName = FirstTool.Name
	
	if dupeTask == nil then
		dupeTask = task.spawn(function()
			while AutoDupe do
				if not Cooldown then
					Cooldown = true
					local ToolId = nil
					local Connection
					
					Connection = ReplicatedStorage.MarketItems.ChildAdded:Connect(function(item)
						if item.Name == ToolName then
							local owner = item:WaitForChild("owner", 2)
							if owner and owner.Value == LocalPlayer.Name then
								ToolId = item:GetAttribute("SpecialId")
							end
						end
					end)
					
					task.defer(function()
						pcall(function()
							ReplicatedStorage.ListWeaponRemote:FireServer(ToolName, 999999)
						end)
					end)
					
					task.wait(0.23)
					
					task.defer(function()
						pcall(function()
							ReplicatedStorage.BackpackRemote:InvokeServer("Store", ToolName)
						end)
					end)
					
					task.wait(2.7)
					
					task.defer(function()
						pcall(function()
							if ToolId then
								ReplicatedStorage.BuyItemRemote:FireServer(ToolName, "Remove", ToolId)
							end
						end)
					end)
					
					task.defer(function()
						pcall(function()
							ReplicatedStorage.BackpackRemote:InvokeServer("Grab", ToolName)
						end)
					end)
					
					if Connection then
						Connection:Disconnect()
					end
					
					Cooldown = false
				end
				task.wait(3.5)
			end
		end)
	end
end

local function StopLoop()
	AutoDupe = false
	if dupeTask then
		task.cancel(dupeTask)
		dupeTask = nil
	end
	Cooldown = false
end

--// GUI
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.IgnoreGuiInset = true
ScreenGui.ResetOnSpawn = false
ScreenGui.Parent = LocalPlayer.PlayerGui

local Main = Instance.new("Frame")
Main.Size = UDim2.fromOffset(315, 335)
Main.Position = UDim2.fromScale(0.5, 0.5)
Main.AnchorPoint = Vector2.new(0.5, 0.5)
Main.BackgroundTransparency = 0.2
Main.BackgroundColor3 = Color3.fromRGB(20, 25, 35)
Main.BorderSizePixel = 0
Main.Parent = ScreenGui

Instance.new("UICorner", Main).CornerRadius = UDim.new(0, 18)

local BackgroundImage = Instance.new("ImageLabel")
BackgroundImage.Size = UDim2.new(1, -10, 1, -10)
BackgroundImage.Position = UDim2.new(0, 5, 0, 5)
BackgroundImage.BackgroundTransparency = 1
BackgroundImage.Image = "rbxassetid://81817688420352"
BackgroundImage.ImageTransparency = 0.3
BackgroundImage.ScaleType = Enum.ScaleType.Stretch
BackgroundImage.ZIndex = 1
Instance.new("UICorner", BackgroundImage).CornerRadius = UDim.new(0, 16)
BackgroundImage.Parent = Main

local Stroke = Instance.new("UIStroke")
Stroke.Color = Color3.fromRGB(255, 0, 0)
Stroke.Thickness = 4
Stroke.Parent = Main

local Glow = Instance.new("Frame")
Glow.Size = UDim2.new(1, 10, 1, 10)
Glow.Position = UDim2.new(0, -5, 0, -5)
Glow.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
Glow.BackgroundTransparency = 0.8
Glow.BorderSizePixel = 0
Glow.ZIndex = 0
Instance.new("UICorner", Glow).CornerRadius = UDim.new(0, 23)
Glow.Parent = Main

-- Header
local Header = Instance.new("Frame")
Header.Size = UDim2.new(1, -15, 0, 45)
Header.Position = UDim2.new(0, 8, 0, 8)
Header.BackgroundTransparency = 1
Header.ZIndex = 2
Header.Parent = Main

local Title = Instance.new("TextLabel")
Title.Text = "Scorpio Hub"
Title.Font = Enum.Font.GothamBold
Title.TextSize = 18
Title.TextColor3 = Color3.fromRGB(255, 0, 0)
Title.BackgroundTransparency = 1
Title.Position = UDim2.new(0,0,0,3)
Title.Size = UDim2.new(1,0,0,18)
Title.TextXAlignment = Enum.TextXAlignment.Center
Title.ZIndex = 2
Title.Parent = Header

local Subtitle = Instance.new("TextLabel")
Subtitle.Text = "THA BRONX 3 • AUTO DUPE"
Subtitle.Font = Enum.Font.Gotham
Subtitle.TextSize = 13
Subtitle.TextColor3 = Color3.fromRGB(255, 0, 0)
Subtitle.BackgroundTransparency = 1
Subtitle.Position = UDim2.new(0,0,0,21)
Subtitle.Size = UDim2.new(1,0,0,15)
Subtitle.TextXAlignment = Enum.TextXAlignment.Center
Subtitle.ZIndex = 2
Subtitle.Parent = Header

-- Row 1: Kill All + Auto Buy Bag
local ButtonFrame1 = Instance.new("Frame")
ButtonFrame1.Size = UDim2.new(1, -30, 0, 38)
ButtonFrame1.Position = UDim2.new(0, 15, 0, 68)
ButtonFrame1.BackgroundTransparency = 1
ButtonFrame1.ZIndex = 2
ButtonFrame1.Parent = Main

local KillAllButton = Instance.new("TextButton")
KillAllButton.Size = UDim2.new(0.48, 0, 1, 0)
KillAllButton.Position = UDim2.new(0, 0, 0, 0)
KillAllButton.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
KillAllButton.Text = "💀 Kill All (5s)"
KillAllButton.Font = Enum.Font.GothamBold
KillAllButton.TextSize = 14
KillAllButton.TextColor3 = Color3.new(1,1,1)
KillAllButton.ZIndex = 2
KillAllButton.Parent = ButtonFrame1
Instance.new("UICorner", KillAllButton).CornerRadius = UDim.new(0, 12)

local KillStroke = Instance.new("UIStroke")
KillStroke.Color = Color3.fromRGB(255, 80, 80)
KillStroke.Thickness = 2
KillStroke.Parent = KillAllButton

local BuyBagToggle = Instance.new("TextButton")
BuyBagToggle.Size = UDim2.new(0.48, 0, 1, 0)
BuyBagToggle.Position = UDim2.new(0.52, 0, 0, 0)
BuyBagToggle.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
BuyBagToggle.Text = "👜 Auto Buy Bag"
BuyBagToggle.Font = Enum.Font.GothamBold
BuyBagToggle.TextSize = 14
BuyBagToggle.TextColor3 = Color3.new(1,1,1)
BuyBagToggle.ZIndex = 2
BuyBagToggle.Parent = ButtonFrame1
Instance.new("UICorner", BuyBagToggle).CornerRadius = UDim.new(0, 12)

local BuyStroke = Instance.new("UIStroke")
BuyStroke.Color = Color3.fromRGB(170, 0, 0)
BuyStroke.Thickness = 2
BuyStroke.Parent = BuyBagToggle

-- Row 2: Live Spot + Buy Lemonade (Side by Side)
local ButtonFrame2 = Instance.new("Frame")
ButtonFrame2.Size = UDim2.new(1, -30, 0, 38)
ButtonFrame2.Position = UDim2.new(0, 15, 0, 115)
ButtonFrame2.BackgroundTransparency = 1
ButtonFrame2.ZIndex = 2
ButtonFrame2.Parent = Main

-- Live Spot (Left)
local LiveSpotButton = Instance.new("TextButton")
LiveSpotButton.Size = UDim2.new(0.48, 0, 1, 0)
LiveSpotButton.Position = UDim2.new(0, 0, 0, 0)
LiveSpotButton.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
LiveSpotButton.Text = "📍 Live Spot"
LiveSpotButton.Font = Enum.Font.GothamBold
LiveSpotButton.TextSize = 14
LiveSpotButton.TextColor3 = Color3.new(1,1,1)
LiveSpotButton.ZIndex = 2
LiveSpotButton.Parent = ButtonFrame2
Instance.new("UICorner", LiveSpotButton).CornerRadius = UDim.new(0, 12)

local LiveStroke = Instance.new("UIStroke")
LiveStroke.Color = Color3.fromRGB(100, 200, 255)
LiveStroke.Thickness = 2
LiveStroke.Parent = LiveSpotButton

-- Buy Lemonade (Right)
local LemonadeButton = Instance.new("TextButton")
LemonadeButton.Size = UDim2.new(0.48, 0, 1, 0)
LemonadeButton.Position = UDim2.new(0.52, 0, 0, 0)
LemonadeButton.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
LemonadeButton.Text = "🍋 Lemonade"
LemonadeButton.Font = Enum.Font.GothamBold
LemonadeButton.TextSize = 14
LemonadeButton.TextColor3 = Color3.new(1,1,1)
LemonadeButton.ZIndex = 2
LemonadeButton.Parent = ButtonFrame2
Instance.new("UICorner", LemonadeButton).CornerRadius = UDim.new(0, 12)

local LemonStroke = Instance.new("UIStroke")
LemonStroke.Color = Color3.fromRGB(170, 0, 0)
LemonStroke.Thickness = 2
LemonStroke.Parent = LemonadeButton

-- Live Spot Logic
LiveSpotButton.MouseButton1Click:Connect(function()
    local Character = LocalPlayer.Character
    local HRP = Character and Character:FindFirstChild("HumanoidRootPart")
    if HRP then
        local LiveSpot = Vector3.new(-1746.336426, 242.506210, -590.672852)
        HRP.CFrame = CFrame.new(LiveSpot)
        
        local notif = Instance.new("TextLabel")
        notif.Size = UDim2.new(0, 200, 0, 50)
        notif.Position = UDim2.new(0.5, -100, 0, 170)
        notif.BackgroundColor3 = Color3.fromRGB(30,30,30)
        notif.Text = "Teleported to Live Spot!"
        notif.TextColor3 = Color3.new(0,1,0)
        notif.Font = Enum.Font.GothamBold
        notif.TextSize = 14
        notif.Parent = Main
        Instance.new("UICorner", notif).CornerRadius = UDim.new(0,8)
        task.delay(2, function() notif:Destroy() end)
    end
end)

-- Buy Lemonade Logic
LemonadeButton.MouseButton1Click:Connect(function()
    pcall(function()
        ReplicatedStorage:WaitForChild("ShopRemote5"):InvokeServer("Lemonade")
    end)
    
    local notif = Instance.new("TextLabel")
    notif.Size = UDim2.new(0, 220, 0, 50)
    notif.Position = UDim2.new(0.5, -110, 0, 170)
    notif.BackgroundColor3 = Color3.fromRGB(30,30,30)
    notif.Text = "Purchased Lemonade!"
    notif.TextColor3 = Color3.new(1, 0.8, 0)
    notif.Font = Enum.Font.GothamBold
    notif.TextSize = 14
    notif.Parent = Main
    Instance.new("UICorner", notif).CornerRadius = UDim.new(0,8)
    task.delay(2, function() notif:Destroy() end)
end)

-- Kill All Logic
KillAllButton.MouseButton1Click:Connect(function()
    local gun = checkgun()
    if not gun then
        local notif = Instance.new("TextLabel")
        notif.Size = UDim2.new(0, 200, 0, 50)
        notif.Position = UDim2.new(0.5, -100, 0, 170)
        notif.BackgroundColor3 = Color3.fromRGB(30,30,30)
        notif.Text = "Gun not found!"
        notif.TextColor3 = Color3.new(1,0,0)
        notif.Font = Enum.Font.GothamBold
        notif.TextSize = 14
        notif.Parent = Main
        Instance.new("UICorner", notif).CornerRadius = UDim.new(0,8)
        task.delay(2, function() notif:Destroy() end)
        return
    end

    local startTime = tick()
    local notif = Instance.new("TextLabel")
    notif.Size = UDim2.new(0, 220, 0, 50)
    notif.Position = UDim2.new(0.5, -110, 0, 170)
    notif.BackgroundColor3 = Color3.fromRGB(30,30,30)
    notif.Text = "Killing everyone for 5 seconds..."
    notif.TextColor3 = Color3.new(1,1,1)
    notif.Font = Enum.Font.Gotham
    notif.TextSize = 13
    notif.Parent = Main
    Instance.new("UICorner", notif).CornerRadius = UDim.new(0,8)
    task.delay(3, function() notif:Destroy() end)

    task.spawn(function()
        local gs = gun:FindFirstChild("GunScript_Server")
        local ig = gs and gs:FindFirstChild("IgniteScript")
        local ic = gs and gs:FindFirstChild("IcifyScript")
        local handle = gun:FindFirstChild("Handle")
        local muzzle = gun:FindFirstChild("GunScript_Local") and gun.GunScript_Local:FindFirstChild("MuzzleEffect")

        while tick() - startTime < 5 do
            if handle and muzzle and ReplicatedStorage:FindFirstChild("VisualizeMuzzle") then
                pcall(function()
                    ReplicatedStorage.VisualizeMuzzle:FireServer(handle, true, {false,7,Color3.new(1,1.1098,0),15,true,0.02}, muzzle)
                end)
            end
            for _, v in pairs(Players:GetPlayers()) do
                if v ~= player then
                    pcall(function()
                        local char = v.Character
                        if not char then return end
                        local head = char:FindFirstChild("Head") or char:FindFirstChild("HumanoidRootPart")
                        if not head then return end
                        local hum = char:FindFirstChildWhichIsA("Humanoid")
                        if not hum then return end

                        ReplicatedStorage.InflictTarget:FireServer(
                            gun, player, hum, head, math.huge,
                            {0,0,false,false,ig,ic,100,100},
                            {false,5,3}, head,
                            {false,{1930359546},1,1.5,1},
                            nil, nil, true
                        )
                    end)
                end
            end
            task.wait(0.1)
        end

        local doneNotif = Instance.new("TextLabel")
        doneNotif.Size = UDim2.new(0, 180, 0, 40)
        doneNotif.Position = UDim2.new(0.5, -90, 0, 170)
        doneNotif.BackgroundColor3 = Color3.fromRGB(30,30,30)
        doneNotif.Text = "Kill All Finished!"
        doneNotif.TextColor3 = Color3.new(0,1,0)
        doneNotif.Font = Enum.Font.GothamBold
        doneNotif.TextSize = 14
        doneNotif.Parent = Main
        Instance.new("UICorner", doneNotif).CornerRadius = UDim.new(0,8)
        task.delay(2, function() doneNotif:Destroy() end)
    end)
end)

-- Auto Buy Bag Logic
BuyBagToggle.MouseButton1Click:Connect(function()
    AutoBuyBagElite = not AutoBuyBagElite
    
    if AutoBuyBagElite then
        BuyBagToggle.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
        BuyBagToggle.Text = "👜 Buying Bag..."
        
        task.spawn(function()
            local Character = LocalPlayer.Character
            local HRP = Character and Character:FindFirstChild("HumanoidRootPart")
            
            if not HRP then 
                AutoBuyBagElite = false
                BuyBagToggle.BackgroundColor3 = Color3.fromRGB(27, 27, 27)
                BuyBagToggle.Text = "👜 Auto Buy Bag"
                return 
            end

            local BagPosition = Vector3.new(-725.833130, 253.918518, -682.548706)
            HRP.CFrame = CFrame.new(BagPosition)
            
            task.wait(0.5)
            
            local Bag = Workspace:FindFirstChild("BagElite", true)
            
            if Bag then
                local Prompt = findProximityPromptRecursive(Bag)
                if Prompt then
                    fireproximityprompt(Prompt)
                end
            end
            
            task.wait(1)
            AutoBuyBagElite = false
            BuyBagToggle.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
            BuyBagToggle.Text = "👜 Auto Buy Bag"
        end)
    else
        BuyBagToggle.BackgroundColor3 = Color3.fromRGB(27, 27, 27)
        BuyBagToggle.Text = "👜 Auto Buy Bag"
    end
end)

-- Status Box
local StatusBox = Instance.new("Frame")
StatusBox.Size = UDim2.new(1,-15,0,41)
StatusBox.Position = UDim2.new(0,8,0,163)
StatusBox.BackgroundColor3 = Color3.fromRGB(20,25,35)
StatusBox.ZIndex = 2
StatusBox.Parent = Main
Instance.new("UICorner", StatusBox).CornerRadius = UDim.new(0, 14)

local Dot = Instance.new("Frame")
Dot.Size = UDim2.fromOffset(8,8)
Dot.Position = UDim2.new(0,11,0.5,-4)
Dot.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
Dot.ZIndex = 2
Dot.Parent = StatusBox
Instance.new("UICorner", Dot).CornerRadius = UDim.new(1,0)

local StatusText = Instance.new("TextLabel")
StatusText.Text = "STATUS\nReady to Duplicate"
StatusText.Font = Enum.Font.Gotham
StatusText.TextSize = 11
StatusText.TextColor3 = Color3.fromRGB(255, 0, 0)
StatusText.BackgroundTransparency = 1
StatusText.Position = UDim2.new(0,26,0,0)
StatusText.Size = UDim2.new(1,-68,1,0)
StatusText.TextXAlignment = Enum.TextXAlignment.Left
StatusText.TextYAlignment = Enum.TextYAlignment.Center
StatusText.ZIndex = 2
StatusText.Parent = StatusBox

local Cash = Instance.new("TextLabel")
Cash.Text = "‼️"
Cash.Font = Enum.Font.GothamBold
Cash.TextSize = 18
Cash.TextColor3 = Color3.fromRGB(255, 0, 0)
Cash.BackgroundTransparency = 1
Cash.Size = UDim2.fromOffset(27,27)
Cash.Position = UDim2.new(1,-33,0.5,-14)
Cash.ZIndex = 2
Cash.Parent = StatusBox

local Instructions = Instance.new("TextLabel")
Instructions.Text = "Hold a tool In your hands, then enable"
Instructions.Font = Enum.Font.Gotham
Instructions.TextSize = 13
Instructions.TextColor3 = Color3.fromRGB(255, 255, 255)
Instructions.BackgroundTransparency = 1
Instructions.Position = UDim2.new(0,8,0,211)
Instructions.Size = UDim2.new(1,-15,0,23)
Instructions.TextXAlignment = Enum.TextXAlignment.Center
Instructions.TextYAlignment = Enum.TextYAlignment.Center
Instructions.ZIndex = 2
Instructions.Parent = Main

local Generate = Instance.new("TextButton")
Generate.Size = UDim2.new(1,-15,0,42)
Generate.Position = UDim2.new(0,8,1,-51)
Generate.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
Generate.Text = "⚡ ON/OFF"
Generate.Font = Enum.Font.GothamBold
Generate.TextSize = 15
Generate.TextColor3 = Color3.new(0,0,0)
Generate.ZIndex = 2
Generate.Parent = Main
Instance.new("UICorner", Generate).CornerRadius = UDim.new(0, 16)

local GenStroke = Instance.new("UIStroke")
GenStroke.Color = Color3.fromRGB(255, 0, 0)
GenStroke.Thickness = 2
GenStroke.Parent = Generate

Generate.MouseButton1Click:Connect(function()
	if not AutoDupe then
		Dot.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
		StatusText.Text = "STATUS\nDuplicating..."
		Generate.Text = "✔️ ON"
		Generate.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
		Generate.TextColor3 = Color3.fromRGB(0, 0, 0)
		GenStroke.Enabled = false
		StartLoop()
	else
		Dot.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
		StatusText.Text = "STATUS\nReady to Duplicate"
		Generate.Text = "✖️ OFF"
		Generate.BackgroundColor3 = Color3.fromRGB(20,25,35)
		Generate.TextColor3 = Color3.new(0,0,0)
		GenStroke.Enabled = true
		StopLoop()
	end
end)

-- Dragging (Main GUI)
local dragging = false
local dragStart, startPos

Header.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		dragging = true
		dragStart = input.Position
		startPos = Main.Position
	end
end)

UserInputService.InputChanged:Connect(function(input)
	if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
		local delta = input.Position - dragStart
		Main.Position = UDim2.new(
			startPos.X.Scale,
			startPos.X.Offset + delta.X,
			startPos.Y.Scale,
			startPos.Y.Offset + delta.Y
		)
	end
end)

UserInputService.InputEnded:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		dragging = false
	end
end)

-- Toggle Button + Dragging
local toggleScreenGui = Instance.new("ScreenGui")
toggleScreenGui.Name = "DupeMenu"
toggleScreenGui.ResetOnSpawn = false
toggleScreenGui.Parent = LocalPlayer.PlayerGui

local toggleButton = Instance.new("ImageButton")
toggleButton.Size = UDim2.new(0, 70, 0, 70)
toggleButton.Position = UDim2.new(0, 10, 0, 50)
toggleButton.Image = "rbxassetid://81817688420352"
toggleButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
toggleButton.BackgroundTransparency = 0.2
toggleButton.ScaleType = Enum.ScaleType.Stretch
Instance.new("UICorner", toggleButton).CornerRadius = UDim.new(0, 10)
toggleButton.Parent = toggleScreenGui

local toggleStroke = Instance.new("UIStroke", toggleButton)
toggleStroke.Color = Color3.fromRGB(255, 0, 0)
toggleStroke.Thickness = 3
toggleStroke.Transparency = 0.2
toggleStroke.LineJoinMode = Enum.LineJoinMode.Round

local toggleGlow = Instance.new("Frame")
toggleGlow.Size = UDim2.new(1, 8, 1, 8)
toggleGlow.Position = UDim2.new(0, -4, 0, -4)
toggleGlow.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
toggleGlow.BackgroundTransparency = 0.7
toggleGlow.BorderSizePixel = 0
toggleGlow.ZIndex = -1
Instance.new("UICorner", toggleGlow).CornerRadius = UDim.new(0, 14)
toggleGlow.Parent = toggleButton

toggleButton.MouseButton1Click:Connect(function()
	Main.Visible = not Main.Visible
end)

local toggleDragging = false
local toggleDragStart, toggleStartPos

toggleButton.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		toggleDragging = true
		toggleDragStart = input.Position
		toggleStartPos = toggleButton.Position
	end
end)

UserInputService.InputChanged:Connect(function(input)
	if toggleDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
		local delta = input.Position - toggleDragStart
		toggleButton.Position = UDim2.new(
			toggleStartPos.X.Scale,
			toggleStartPos.X.Offset + delta.X,
			toggleStartPos.Y.Scale,
			toggleStartPos.Y.Offset + delta.Y
		)
	end
end)

UserInputService.InputEnded:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		toggleDragging = false
	end
end)

-- Mouse Icon Fix
RunService.RenderStepped:Connect(function()
	if LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Tool") then
		UserInputService.MouseIconEnabled = true
		Mouse.Icon = ""
	end
end)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: