SOURCE AUTO COLLECT AUTO BUY AUTO OPEN MORE MOBILE PC
Key Required

SOURCE AUTO COLLECT AUTO BUY AUTO OPEN MORE MOBILE PC

My Card Collectionleetleet 724 views 25 executesUpdated Dec 17, 2025
Unrated
00
Lua Script•1544 lines (50559 chars)
if getgenv().CardCollectionFarm then
    pcall(function() getgenv().CardCollectionFarm.Unload() end)
    task.wait(0.3)
end

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

local LocalPlayer = Players.LocalPlayer

local function GetRemote(folder, name)
    local parent = ReplicatedStorage:FindFirstChild(folder)
    return parent and parent:FindFirstChild(name)
end

local Remotes = {
    ClickSlot = GetRemote("RemoteEvents", "ClickSlot"),
}

local PackTypes = {
    "Any",
    "Leaf Pack",
    "Heart Pack", 
    "Sun Pack",
    "Sun Pack2",
    "Fire Pack",
    "Water Pack",
    "Star Pack",
    "Moon Pack",
    "Rainbow Pack",
    "Gold Pack",
    "Diamond Pack",
    "Crystal Pack",
    "Shiny Pack",
    "Holographic Pack",
    "Premium Pack",
    "Legendary Pack",
    "Rare Pack",
    "Epic Pack",
    "Mythic Pack",
}

local Config = {
    AutoCollect = false,
    CollectDelay = 0.02,
    CollectInterval = 2,
    
    AutoBuyPacks = false,
    BuyDelay = 2,
    SelectedPackTypes = {},
    
    AutoOpenPacks = false,
    OpenDelay = 0.3,
}

local CachedSlots = {}
local LastSlotCache = 0

local State = {
    Running = true,
    Collecting = false,
    BuyingPacks = false,
    OpeningPacks = false,
}

local Connections = {}
local Threads = {}
local ScreenGui = nil

local Stats = {
    MoneyCollected = 0,
    PacksBought = 0,
    PacksOpened = 0,
    SessionStart = tick(),
}

local function SafeCancel(name)
    if Threads[name] then
        pcall(function() task.cancel(Threads[name]) end)
        Threads[name] = nil
    end
end

local function DisconnectAll()
    for name, conn in pairs(Connections) do
        pcall(function() conn:Disconnect() end)
        Connections[name] = nil
    end
end

local function CancelAllThreads()
    for name in pairs(Threads) do
        SafeCancel(name)
    end
end

local function Unload()
    State.Running = false
    Config.AutoCollect = false
    Config.AutoBuyPacks = false
    Config.AutoOpenPacks = false
    
    task.wait(0.1)
    DisconnectAll()
    CancelAllThreads()
    
    if ScreenGui then
        pcall(function() ScreenGui:Destroy() end)
        ScreenGui = nil
    end
    
    getgenv().CardCollectionFarm = nil
end

local function GetPlayerPlot()
    local char = LocalPlayer.Character
    if not char then return nil end
    
    local root = char:FindFirstChild("HumanoidRootPart")
    if not root then return nil end
    
    local myPos = root.Position
    local plots = Workspace:FindFirstChild("Plots")
    if not plots then return nil end
    
    local closest = nil
    local closestDist = math.huge
    
    for _, plot in ipairs(plots:GetChildren()) do
        if plot:IsA("Model") then
            local primary = plot.PrimaryPart or plot:FindFirstChildWhichIsA("BasePart")
            if primary then
                local dist = (myPos - primary.Position).Magnitude
                if dist < closestDist and dist < 150 then
                    closestDist = dist
                    closest = plot
                end
            end
        end
    end
    
    return closest
end

local function ParsePrice(text)
    if not text then return nil end
    text = text:gsub("%$", ""):gsub(",", ""):gsub(" ", "")
    local num, suffix = text:match("^([%d%.]+)([kKmMbB]?)$")
    if not num then return nil end
    num = tonumber(num)
    if not num then return nil end
    suffix = suffix:lower()
    if suffix == "k" then
        num = num * 1000
    elseif suffix == "m" then
        num = num * 1000000
    elseif suffix == "b" then
        num = num * 1000000000
    end
    return math.floor(num)
end

local function GetPackPrice(pack)
    local packGui = pack:FindFirstChild("PackGui")
    if packGui then
        local costText = packGui:FindFirstChild("CostText")
        if costText and costText:IsA("TextLabel") then
            return ParsePrice(costText.Text)
        end
    end
    for _, desc in ipairs(pack:GetDescendants()) do
        if desc:IsA("TextLabel") and desc.Name == "CostText" then
            return ParsePrice(desc.Text)
        end
    end
    return nil
end

local function GetPlayerMoney()
    local leaderstats = LocalPlayer:FindFirstChild("leaderstats")
    if leaderstats then
        local cash = leaderstats:FindFirstChild("Cash") or leaderstats:FindFirstChild("Money") or leaderstats:FindFirstChild("Coins")
        if cash then
            return cash.Value
        end
        for _, stat in ipairs(leaderstats:GetChildren()) do
            if stat:IsA("NumberValue") or stat:IsA("IntValue") then
                return stat.Value
            end
        end
    end
    
    local playerGui = LocalPlayer:FindFirstChild("PlayerGui")
    if playerGui then
        for _, gui in ipairs(playerGui:GetDescendants()) do
            if gui:IsA("TextLabel") then
                local text = gui.Text
                if text:match("^%$[%d,%.]+[kKmMbB]?$") then
                    return ParsePrice(text)
                end
            end
        end
    end
    
    return 0
end

local function CanAffordPack(pack)
    local price = GetPackPrice(pack)
    if not price then return true end
    local money = GetPlayerMoney()
    return money >= price
end

local function ScanPackTypes()
    local found = {["Any"] = true}
    local plot = GetPlayerPlot()
    
    if plot then
        local conveyor = plot:FindFirstChild("Conveyor")
        if conveyor then
            for _, desc in ipairs(conveyor:GetDescendants()) do
                if desc:IsA("Model") and desc.Name:lower():find("pack") then
                    found[desc.Name] = true
                end
            end
        end
        
        local placedPacks = plot:FindFirstChild("PlacedPacks")
        if placedPacks then
            for _, pack in ipairs(placedPacks:GetChildren()) do
                if pack:IsA("Model") then
                    found[pack.Name] = true
                end
            end
        end
    end
    
    for _, packType in ipairs(PackTypes) do
        found[packType] = true
    end
    
    local result = {"Any"}
    for name, _ in pairs(found) do
        if name ~= "Any" then
            table.insert(result, name)
        end
    end
    
    table.sort(result, function(a, b)
        if a == "Any" then return true end
        if b == "Any" then return false end
        return a < b
    end)
    
    return result
end

local function GetPageCount()
    local plot = GetPlayerPlot()
    if not plot then return 0 end
    
    local binder = plot:FindFirstChild("Binder")
    if not binder then return 0 end
    
    local count = 0
    for i = 1, 100 do
        if binder:FindFirstChild("Page" .. i) then
            count = i
        else
            break
        end
    end
    return count
end

local function GetPageSlots(pageNum)
    local slots = {}
    local plot = GetPlayerPlot()
    if not plot then return slots end
    
    local binder = plot:FindFirstChild("Binder")
    if not binder then return slots end
    
    local page = binder:FindFirstChild("Page" .. pageNum)
    if not page then return slots end
    
    local pageModel = page:FindFirstChild("Page")
    if not pageModel then return slots end
    
    local slotsFolder = pageModel:FindFirstChild("Slots")
    if not slotsFolder then return slots end
    
    for _, slot in ipairs(slotsFolder:GetChildren()) do
        if slot:IsA("BasePart") and slot.Parent then
            local slotName = slot.Name:lower()
            if slotName ~= "cardtemplates" and slotName ~= "templates" then
                table.insert(slots, slot)
            end
        end
    end
    
    return slots
end

local function GetAllSlots(forceRefresh)
    local now = tick()
    
    if not forceRefresh and #CachedSlots > 0 and (now - LastSlotCache) < 30 then
        return CachedSlots
    end
    
    local allSlots = {}
    local pageCount = GetPageCount()
    
    for pageNum = 1, pageCount do
        local pageSlots = GetPageSlots(pageNum)
        for _, slot in ipairs(pageSlots) do
            table.insert(allSlots, slot)
        end
    end
    
    CachedSlots = allSlots
    LastSlotCache = now
    
    return allSlots
end

local function CollectFromAllSlots(isManual)
    if not Remotes.ClickSlot then 
        return 0 
    end
    
    local allSlots = GetAllSlots(true)
    if #allSlots == 0 then
        return 0
    end
    
    local collected = 0
    
    for i, slot in ipairs(allSlots) do
        if not State.Running then break end
        if not isManual and not Config.AutoCollect then break end
        
        if slot and slot.Parent then
            pcall(function()
                Remotes.ClickSlot:FireServer(slot)
                collected = collected + 1
            end)
            
            if Config.CollectDelay > 0 then
                task.wait(Config.CollectDelay)
            end
        end
        
        if i % 10 == 0 then
            task.wait()
        end
    end
    
    return collected
end

local function CollectMoney(isManual)
    local collected = CollectFromAllSlots(isManual)
    Stats.MoneyCollected = Stats.MoneyCollected + collected
    return collected
end

local function GetPlacedPacks()
    local packs = {}
    local added = {}
    local plot = GetPlayerPlot()
    if not plot then return packs end
    
    local function AddPack(pack)
        if pack and pack:IsA("Model") and not added[pack] then
            added[pack] = true
            table.insert(packs, pack)
        end
    end
    
    local placedPacks = plot:FindFirstChild("PlacedPacks")
    if placedPacks then
        for _, pack in ipairs(placedPacks:GetChildren()) do
            AddPack(pack)
        end
        for _, pack in ipairs(placedPacks:GetDescendants()) do
            if pack:IsA("Model") then
                AddPack(pack)
            end
        end
    end
    
    local searchFolders = {"Floor", "PackFloor", "Packs", "OpenPacks", "ReadyPacks"}
    for _, folderName in ipairs(searchFolders) do
        local folder = plot:FindFirstChild(folderName)
        if folder then
            for _, pack in ipairs(folder:GetChildren()) do
                AddPack(pack)
            end
        end
    end
    
    for _, child in ipairs(plot:GetChildren()) do
        if child:IsA("Model") then
            local name = child.Name:lower()
            if name:find("pack") or name:find("moon") or name:find("sun") or name:find("leaf") or name:find("heart") or name:find("fire") or name:find("star") then
                AddPack(child)
            end
        end
    end
    
    for _, desc in ipairs(plot:GetDescendants()) do
        if desc:IsA("Model") then
            local name = desc.Name:lower()
            if name:find("pack") then
                if desc.Parent and desc.Parent.Name ~= "Conveyor" and desc.Parent.Name ~= "ActivePacks" then
                    AddPack(desc)
                end
            end
        end
    end
    
    return packs
end

local function IsPackReady(pack)
    local openTimeGui = nil
    for _, desc in ipairs(pack:GetDescendants()) do
        if desc:IsA("BillboardGui") and desc.Name == "OpenTimeGui" then
            openTimeGui = desc
            break
        end
    end
    
    if openTimeGui then
        local timeText = openTimeGui:FindFirstChild("TimeText")
        if timeText and timeText:IsA("TextLabel") then
            local text = timeText.Text:lower()
            if text == "ready!" or text == "ready" then
                return true
            end
            if text:match("%d+s") or text:match("%d+m") or text:match("%d+:%d+") then
                return false
            end
        end
    end
    
    for _, desc in ipairs(pack:GetDescendants()) do
        if desc:IsA("TextLabel") and desc.Name == "TimeText" then
            local text = desc.Text:lower()
            if text == "ready!" or text == "ready" then
                return true
            end
            if text:match("%d+s") or text:match("%d+m") or text:match("%d+:%d+") then
                return false
            end
        end
    end
    
    return true
end

local function OpenPack(pack)
    if not pack or not pack.Parent then return false end
    
    local handle = pack:FindFirstChild("Handle")
    if not handle then
        for _, desc in ipairs(pack:GetDescendants()) do
            if desc:IsA("BasePart") then
                handle = desc
                break
            end
        end
    end
    
    if not handle then return false end
    
    local prompt = nil
    for _, desc in ipairs(pack:GetDescendants()) do
        if desc:IsA("ProximityPrompt") then
            prompt = desc
            break
        end
    end
    
    local char = LocalPlayer.Character
    local hrp = char and char:FindFirstChild("HumanoidRootPart")
    if not hrp then return false end
    
    local oldCFrame = hrp.CFrame
    pcall(function()
        hrp.CFrame = handle.CFrame * CFrame.new(0, 0, 2)
    end)
    task.wait(0.1)
    
    local success = false
    
    if prompt and fireproximityprompt then
        pcall(function() fireproximityprompt(prompt) end)
        success = true
    end
    
    if not success and firetouchinterest then
        pcall(function()
            firetouchinterest(hrp, handle, 0)
            task.wait()
            firetouchinterest(hrp, handle, 1)
        end)
        success = true
    end
    
    task.wait(0.1)
    pcall(function()
        hrp.CFrame = oldCFrame
    end)
    
    if success then
        Stats.PacksOpened = Stats.PacksOpened + 1
    end
    
    return success
end

local function OpenReadyPacks()
    local packs = GetPlacedPacks()
    local opened = 0
    
    for _, pack in ipairs(packs) do
        if not State.Running then break end
        
        if IsPackReady(pack) then
            if OpenPack(pack) then
                opened = opened + 1
                task.wait(Config.OpenDelay)
            end
        end
    end
    
    return opened
end


local function MatchesPackType(pack)
    if Config.SelectedPackTypes["Any"] or next(Config.SelectedPackTypes) == nil then
        return true
    end
    
    local packName = pack.Name:lower()
    
    for selectedType, enabled in pairs(Config.SelectedPackTypes) do
        if enabled and selectedType ~= "Any" then
            local typeKey = selectedType:lower():gsub(" pack", ""):gsub("pack", ""):gsub("^%s+", ""):gsub("%s+$", "")
            
            if packName:find(typeKey) then return true end
            if packName == selectedType:lower() then return true end
            
            for _, desc in ipairs(pack:GetDescendants()) do
                if desc:IsA("TextLabel") or desc:IsA("TextButton") then
                    local text = desc.Text:lower()
                    if text:find(typeKey) then return true end
                end
            end
        end
    end
    
    return false
end

local function BuyPack()
    local plot = GetPlayerPlot()
    if not plot then return false end
    
    local conveyor = plot:FindFirstChild("Conveyor")
    if not conveyor then return false end
    
    local activePacks = conveyor:FindFirstChild("ActivePacks")
    if not activePacks then return false end
    
    local packs = activePacks:GetChildren()
    if #packs == 0 then return false end
    
    local pack = nil
    for _, p in ipairs(packs) do
        if p:IsA("Model") and MatchesPackType(p) and CanAffordPack(p) then
            pack = p
            break
        end
    end
    
    if not pack then return false end
    
    local handle = pack:FindFirstChild("Handle")
    if not handle then return false end
    
    local prompt = handle:FindFirstChildOfClass("ProximityPrompt")
    if not prompt then return false end
    
    local char = LocalPlayer.Character
    local hrp = char and char:FindFirstChild("HumanoidRootPart")
    if not hrp then return false end
    
    local oldCFrame = hrp.CFrame
    pcall(function()
        hrp.CFrame = handle.CFrame * CFrame.new(0, 0, 2)
    end)
    task.wait(0.1)
    
    if fireproximityprompt then
        pcall(function() fireproximityprompt(prompt) end)
    end
    
    task.wait(0.1)
    pcall(function()
        hrp.CFrame = oldCFrame
    end)
    
    Stats.PacksBought = Stats.PacksBought + 1
    return true
end

local function FormatNumber(num)
    if num >= 1000000 then
        return string.format("%.1fM", num / 1000000)
    elseif num >= 1000 then
        return string.format("%.1fK", num / 1000)
    end
    return tostring(math.floor(num))
end

local function GetSessionTime()
    local elapsed = tick() - Stats.SessionStart
    local mins = math.floor(elapsed / 60)
    local secs = math.floor(elapsed % 60)
    return string.format("%dm %ds", mins, secs)
end

local function StartAutoCollect()
    if State.Collecting then return end
    State.Collecting = true
    
    Threads["Collect"] = task.spawn(function()
        while Config.AutoCollect and State.Running do
            CollectMoney()
            task.wait(Config.CollectInterval)
        end
        State.Collecting = false
    end)
end

local function StopAutoCollect()
    Config.AutoCollect = false
    SafeCancel("Collect")
    State.Collecting = false
end

local function StartAutoBuyPacks()
    if State.BuyingPacks then return end
    State.BuyingPacks = true
    
    Threads["BuyPacks"] = task.spawn(function()
        while Config.AutoBuyPacks and State.Running do
            BuyPack()
            task.wait(Config.BuyDelay)
        end
        State.BuyingPacks = false
    end)
end

local function StopAutoBuyPacks()
    Config.AutoBuyPacks = false
    SafeCancel("BuyPacks")
    State.BuyingPacks = false
end

local function StartAutoOpenPacks()
    if State.OpeningPacks then return end
    State.OpeningPacks = true
    
    Threads["OpenPacks"] = task.spawn(function()
        while Config.AutoOpenPacks and State.Running do
            OpenReadyPacks()
            task.wait(1)
        end
        State.OpeningPacks = false
    end)
end

local function StopAutoOpenPacks()
    Config.AutoOpenPacks = false
    SafeCancel("OpenPacks")
    State.OpeningPacks = false
end

local function CreateGUI()
    local isMobile = UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled
    
    ScreenGui = Instance.new("ScreenGui")
    ScreenGui.Name = "CardFarmGUI"
    ScreenGui.ResetOnSpawn = false
    ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
    ScreenGui.IgnoreGuiInset = true
    
    pcall(function()
        if syn then
            syn.protect_gui(ScreenGui)
        elseif gethui then
            ScreenGui.Parent = gethui()
            return
        end
    end)
    
    ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
    
    local Icons = {
        Power = "rbxassetid://97421363782839",
    }
    
    local Accent = Color3.fromRGB(0, 170, 255)
    local GlassBg = Color3.fromRGB(40, 44, 52)
    local GlassCard = Color3.fromRGB(55, 60, 70)
    local TextPrimary = Color3.fromRGB(255, 255, 255)
    local TextSecondary = Color3.fromRGB(140, 145, 155)
    
    local MainContainer = Instance.new("Frame")
    MainContainer.Name = "MainContainer"
    MainContainer.AnchorPoint = Vector2.new(0.5, 0.5)
    MainContainer.Position = UDim2.new(0.5, 0, 0.5, 0)
    MainContainer.Size = isMobile and UDim2.new(0.85, 0, 0, 340) or UDim2.new(0, 520, 0, 280)
    MainContainer.BackgroundColor3 = GlassBg
    MainContainer.BackgroundTransparency = 0.05
    MainContainer.BorderSizePixel = 0
    MainContainer.ClipsDescendants = true
    MainContainer.Parent = ScreenGui
    
    local MainCorner = Instance.new("UICorner")
    MainCorner.CornerRadius = UDim.new(0, 16)
    MainCorner.Parent = MainContainer
    
    local TopBar = Instance.new("Frame")
    TopBar.Size = UDim2.new(1, 0, 0, 44)
    TopBar.BackgroundColor3 = Color3.fromRGB(35, 38, 46)
    TopBar.BackgroundTransparency = 0.3
    TopBar.BorderSizePixel = 0
    TopBar.Parent = MainContainer
    
    local TopCorner = Instance.new("UICorner")
    TopCorner.CornerRadius = UDim.new(0, 16)
    TopCorner.Parent = TopBar
    
    local FarmingTab = Instance.new("TextButton")
    FarmingTab.Size = UDim2.new(0, 80, 0, 30)
    FarmingTab.Position = UDim2.new(0, 12, 0.5, -15)
    FarmingTab.BackgroundColor3 = Accent
    FarmingTab.BackgroundTransparency = 0.7
    FarmingTab.BorderSizePixel = 0
    FarmingTab.Text = "Farming"
    FarmingTab.TextSize = 12
    FarmingTab.Font = Enum.Font.GothamBold
    FarmingTab.TextColor3 = TextPrimary
    FarmingTab.Parent = TopBar
    
    local FarmCorner = Instance.new("UICorner")
    FarmCorner.CornerRadius = UDim.new(0, 8)
    FarmCorner.Parent = FarmingTab
    
    local ActionsTab = Instance.new("TextButton")
    ActionsTab.Size = UDim2.new(0, 70, 0, 30)
    ActionsTab.Position = UDim2.new(0, 100, 0.5, -15)
    ActionsTab.BackgroundTransparency = 1
    ActionsTab.BorderSizePixel = 0
    ActionsTab.Text = "Actions"
    ActionsTab.TextSize = 12
    ActionsTab.Font = Enum.Font.GothamMedium
    ActionsTab.TextColor3 = TextSecondary
    ActionsTab.Parent = TopBar
    
    local ActionsCorner = Instance.new("UICorner")
    ActionsCorner.CornerRadius = UDim.new(0, 8)
    ActionsCorner.Parent = ActionsTab
    
    local PowerBtn = Instance.new("ImageButton")
    PowerBtn.Size = UDim2.new(0, 28, 0, 28)
    PowerBtn.Position = UDim2.new(1, -42, 0.5, -14)
    PowerBtn.BackgroundColor3 = Color3.fromRGB(200, 60, 60)
    PowerBtn.BackgroundTransparency = 0.6
    PowerBtn.BorderSizePixel = 0
    PowerBtn.Image = Icons.Power
    PowerBtn.ImageColor3 = TextPrimary
    PowerBtn.Parent = TopBar
    
    local PowerCorner = Instance.new("UICorner")
    PowerCorner.CornerRadius = UDim.new(0, 8)
    PowerCorner.Parent = PowerBtn
    
    PowerBtn.MouseButton1Click:Connect(Unload)
    
    local AvatarFrame = Instance.new("Frame")
    AvatarFrame.Size = UDim2.new(0, 32, 0, 32)
    AvatarFrame.Position = UDim2.new(1, -80, 0.5, -16)
    AvatarFrame.BackgroundColor3 = GlassCard
    AvatarFrame.BorderSizePixel = 0
    AvatarFrame.Parent = TopBar
    
    local AvatarCorner = Instance.new("UICorner")
    AvatarCorner.CornerRadius = UDim.new(1, 0)
    AvatarCorner.Parent = AvatarFrame
    
    local AvatarImg = Instance.new("ImageLabel")
    AvatarImg.Size = UDim2.new(1, 0, 1, 0)
    AvatarImg.BackgroundTransparency = 1
    AvatarImg.Parent = AvatarFrame
    
    task.spawn(function()
        local ok, img = pcall(function()
            return Players:GetUserThumbnailAsync(LocalPlayer.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
        end)
        if ok then AvatarImg.Image = img end
    end)
    
    local AvatarImgCorner = Instance.new("UICorner")
    AvatarImgCorner.CornerRadius = UDim.new(1, 0)
    AvatarImgCorner.Parent = AvatarImg
    
    local FarmingPanel = Instance.new("Frame")
    FarmingPanel.Name = "FarmingPanel"
    FarmingPanel.Size = UDim2.new(1, -16, 1, -52)
    FarmingPanel.Position = UDim2.new(0, 8, 0, 48)
    FarmingPanel.BackgroundTransparency = 1
    FarmingPanel.Parent = MainContainer
    
    local ActionsPanel = Instance.new("Frame")
    ActionsPanel.Name = "ActionsPanel"
    ActionsPanel.Size = UDim2.new(1, -16, 1, -52)
    ActionsPanel.Position = UDim2.new(0, 8, 0, 48)
    ActionsPanel.BackgroundTransparency = 1
    ActionsPanel.Visible = false
    ActionsPanel.Parent = MainContainer
    
    FarmingTab.MouseButton1Click:Connect(function()
        FarmingPanel.Visible = true
        ActionsPanel.Visible = false
        FarmingTab.BackgroundTransparency = 0.7
        FarmingTab.TextColor3 = TextPrimary
        ActionsTab.BackgroundTransparency = 1
        ActionsTab.TextColor3 = TextSecondary
    end)
    
    ActionsTab.MouseButton1Click:Connect(function()
        FarmingPanel.Visible = false
        ActionsPanel.Visible = true
        FarmingTab.BackgroundTransparency = 1
        FarmingTab.TextColor3 = TextSecondary
        ActionsTab.BackgroundTransparency = 0.7
        ActionsTab.BackgroundColor3 = Accent
        ActionsTab.TextColor3 = TextPrimary
    end)
    
    local function CreateToggle(parent, pos, size, label, default, callback)
        local Frame = Instance.new("Frame")
        Frame.Size = size
        Frame.Position = pos
        Frame.BackgroundColor3 = GlassCard
        Frame.BackgroundTransparency = 0.4
        Frame.BorderSizePixel = 0
        Frame.Parent = parent
        
        local Corner = Instance.new("UICorner")
        Corner.CornerRadius = UDim.new(0, 12)
        Corner.Parent = Frame
        
        local Label = Instance.new("TextLabel")
        Label.Size = UDim2.new(1, -60, 1, 0)
        Label.Position = UDim2.new(0, 12, 0, 0)
        Label.BackgroundTransparency = 1
        Label.Text = label
        Label.TextSize = 11
        Label.Font = Enum.Font.GothamMedium
        Label.TextColor3 = TextPrimary
        Label.TextXAlignment = Enum.TextXAlignment.Left
        Label.Parent = Frame
        
        local ToggleBg = Instance.new("Frame")
        ToggleBg.Size = UDim2.new(0, 40, 0, 22)
        ToggleBg.Position = UDim2.new(1, -50, 0.5, -11)
        ToggleBg.BackgroundColor3 = default and Accent or Color3.fromRGB(60, 65, 75)
        ToggleBg.BorderSizePixel = 0
        ToggleBg.Parent = Frame
        
        local BgCorner = Instance.new("UICorner")
        BgCorner.CornerRadius = UDim.new(1, 0)
        BgCorner.Parent = ToggleBg
        
        local Circle = Instance.new("Frame")
        Circle.Size = UDim2.new(0, 16, 0, 16)
        Circle.Position = default and UDim2.new(1, -19, 0.5, -8) or UDim2.new(0, 3, 0.5, -8)
        Circle.BackgroundColor3 = TextPrimary
        Circle.BorderSizePixel = 0
        Circle.Parent = ToggleBg
        
        local CircleCorner = Instance.new("UICorner")
        CircleCorner.CornerRadius = UDim.new(1, 0)
        CircleCorner.Parent = Circle
        
        local enabled = default
        local Btn = Instance.new("TextButton")
        Btn.Size = UDim2.new(1, 0, 1, 0)
        Btn.BackgroundTransparency = 1
        Btn.Text = ""
        Btn.Parent = Frame
        
        Btn.MouseButton1Click:Connect(function()
            enabled = not enabled
            TweenService:Create(ToggleBg, TweenInfo.new(0.2), {
                BackgroundColor3 = enabled and Accent or Color3.fromRGB(60, 65, 75)
            }):Play()
            TweenService:Create(Circle, TweenInfo.new(0.2, Enum.EasingStyle.Back), {
                Position = enabled and UDim2.new(1, -19, 0.5, -8) or UDim2.new(0, 3, 0.5, -8)
            }):Play()
            callback(enabled)
        end)
        
        return Frame
    end
    
    local function CreateSlider(parent, pos, size, label, min, max, default, callback)
        min = math.min(min, max)
        default = math.clamp(default, min, max)
        
        local Frame = Instance.new("Frame")
        Frame.Size = size
        Frame.Position = pos
        Frame.BackgroundColor3 = GlassCard
        Frame.BackgroundTransparency = 0.4
        Frame.BorderSizePixel = 0
        Frame.Parent = parent
        
        local Corner = Instance.new("UICorner")
        Corner.CornerRadius = UDim.new(0, 12)
        Corner.Parent = Frame
        
        local Label = Instance.new("TextLabel")
        Label.Size = UDim2.new(0.6, 0, 0, 18)
        Label.Position = UDim2.new(0, 12, 0, 6)
        Label.BackgroundTransparency = 1
        Label.Text = label
        Label.TextSize = 11
        Label.Font = Enum.Font.GothamMedium
        Label.TextColor3 = TextPrimary
        Label.TextXAlignment = Enum.TextXAlignment.Left
        Label.Parent = Frame
        
        local Value = Instance.new("TextLabel")
        Value.Size = UDim2.new(0.3, 0, 0, 18)
        Value.Position = UDim2.new(0.7, -12, 0, 6)
        Value.BackgroundTransparency = 1
        Value.Text = tostring(default)
        Value.TextSize = 11
        Value.Font = Enum.Font.GothamBold
        Value.TextColor3 = Accent
        Value.TextXAlignment = Enum.TextXAlignment.Right
        Value.Parent = Frame
        
        local SliderBg = Instance.new("Frame")
        SliderBg.Size = UDim2.new(1, -24, 0, 6)
        SliderBg.Position = UDim2.new(0, 12, 0, 32)
        SliderBg.BackgroundColor3 = Color3.fromRGB(50, 55, 65)
        SliderBg.BorderSizePixel = 0
        SliderBg.Parent = Frame
        
        local BgCorner = Instance.new("UICorner")
        BgCorner.CornerRadius = UDim.new(1, 0)
        BgCorner.Parent = SliderBg
        
        local Fill = Instance.new("Frame")
        Fill.Size = UDim2.new((default - min) / (max - min), 0, 1, 0)
        Fill.BackgroundColor3 = Accent
        Fill.BorderSizePixel = 0
        Fill.Parent = SliderBg
        
        local FillCorner = Instance.new("UICorner")
        FillCorner.CornerRadius = UDim.new(1, 0)
        FillCorner.Parent = Fill
        
        local currentValue = default
        local dragging = false
        
        local SliderBtn = Instance.new("TextButton")
        SliderBtn.Size = UDim2.new(1, 0, 0, 20)
        SliderBtn.Position = UDim2.new(0, 0, 0, 24)
        SliderBtn.BackgroundTransparency = 1
        SliderBtn.Text = ""
        SliderBtn.Parent = Frame
        
        local function UpdateSlider(inputPos)
            local pct = math.clamp((inputPos - SliderBg.AbsolutePosition.X) / SliderBg.AbsoluteSize.X, 0, 1)
            currentValue = math.floor((min + (max - min) * pct) * 10) / 10
            Fill.Size = UDim2.new(pct, 0, 1, 0)
            Value.Text = tostring(currentValue)
            callback(currentValue)
        end
        
        SliderBtn.InputBegan:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
                dragging = true
                UpdateSlider(input.Position.X)
            end
        end)
        
        SliderBtn.InputEnded:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
                dragging = false
            end
        end)
        
        Connections["Slider_" .. label] = UserInputService.InputChanged:Connect(function(input)
            if dragging and State.Running and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
                UpdateSlider(input.Position.X)
            end
        end)
        
        return Frame
    end
    
    local activeDropdown = nil
    local activeDropdownBtn = nil
    
    local function IsPointInFrame(frame, x, y)
        if not frame or not frame.Parent then return false end
        local absPos = frame.AbsolutePosition
        local absSize = frame.AbsoluteSize
        return x >= absPos.X and x <= absPos.X + absSize.X and y >= absPos.Y and y <= absPos.Y + absSize.Y
    end
    
    local function CloseActiveDropdown()
        if activeDropdown then
            activeDropdown.Visible = false
            activeDropdown = nil
            activeDropdownBtn = nil
        end
    end
    
    Connections["DropdownClose"] = UserInputService.InputBegan:Connect(function(input)
        if not activeDropdown then return end
        if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then return end
        
        local x, y = input.Position.X, input.Position.Y
        
        if IsPointInFrame(activeDropdown, x, y) then return end
        if activeDropdownBtn and IsPointInFrame(activeDropdownBtn, x, y) then return end
        
        CloseActiveDropdown()
    end)
    
    local function CreateMultiDropdown(parent, pos, size, label, options, configTable, configKey)
        local Frame = Instance.new("Frame")
        Frame.Size = size
        Frame.Position = pos
        Frame.BackgroundColor3 = GlassCard
        Frame.BackgroundTransparency = 0.4
        Frame.BorderSizePixel = 0
        Frame.Parent = parent
        
        local Corner = Instance.new("UICorner")
        Corner.CornerRadius = UDim.new(0, 12)
        Corner.Parent = Frame
        
        local Label = Instance.new("TextLabel")
        Label.Size = UDim2.new(0.4, 0, 1, 0)
        Label.Position = UDim2.new(0, 12, 0, 0)
        Label.BackgroundTransparency = 1
        Label.Text = label
        Label.TextSize = 11
        Label.Font = Enum.Font.GothamMedium
        Label.TextColor3 = TextPrimary
        Label.TextXAlignment = Enum.TextXAlignment.Left
        Label.Parent = Frame
        
        local function GetDisplayText()
            local selected = {}
            for opt, enabled in pairs(configTable[configKey]) do
                if enabled then
                    table.insert(selected, opt)
                end
            end
            if #selected == 0 then return "Any" end
            if #selected == 1 then return selected[1] end
            if configTable[configKey]["Any"] then return "Any" end
            return #selected .. " selected"
        end
        
        local DropBtn = Instance.new("TextButton")
        DropBtn.Size = UDim2.new(0.55, -16, 0, 26)
        DropBtn.Position = UDim2.new(0.45, 4, 0.5, -13)
        DropBtn.BackgroundColor3 = Color3.fromRGB(50, 55, 65)
        DropBtn.BorderSizePixel = 0
        DropBtn.Text = GetDisplayText()
        DropBtn.TextSize = 10
        DropBtn.Font = Enum.Font.GothamMedium
        DropBtn.TextColor3 = TextPrimary
        DropBtn.TextTruncate = Enum.TextTruncate.AtEnd
        DropBtn.Parent = Frame
        
        local DropBtnCorner = Instance.new("UICorner")
        DropBtnCorner.CornerRadius = UDim.new(0, 6)
        DropBtnCorner.Parent = DropBtn
        
        local DropFrame = Instance.new("Frame")
        DropFrame.Size = UDim2.new(0, 160, 0, math.min(#options * 28, 220))
        DropFrame.BackgroundColor3 = Color3.fromRGB(35, 38, 46)
        DropFrame.BorderSizePixel = 0
        DropFrame.Visible = false
        DropFrame.ZIndex = 100
        DropFrame.ClipsDescendants = true
        DropFrame.Parent = ScreenGui
        
        local DropCorner = Instance.new("UICorner")
        DropCorner.CornerRadius = UDim.new(0, 8)
        DropCorner.Parent = DropFrame
        
        local DropScroll = Instance.new("ScrollingFrame")
        DropScroll.Size = UDim2.new(1, -6, 1, -4)
        DropScroll.Position = UDim2.new(0, 2, 0, 2)
        DropScroll.BackgroundTransparency = 1
        DropScroll.ScrollBarThickness = 3
        DropScroll.ScrollBarImageColor3 = Accent
        DropScroll.BorderSizePixel = 0
        DropScroll.CanvasSize = UDim2.new(0, 0, 0, #options * 28)
        DropScroll.ZIndex = 101
        DropScroll.Parent = DropFrame
        
        local DropLayout = Instance.new("UIListLayout")
        DropLayout.SortOrder = Enum.SortOrder.LayoutOrder
        DropLayout.Padding = UDim.new(0, 2)
        DropLayout.Parent = DropScroll
        
        local optionButtons = {}
        
        local function UpdateOptionVisuals()
            for opt, btn in pairs(optionButtons) do
                local isSelected = configTable[configKey][opt] == true
                btn.check.Text = isSelected and "✓" or ""
                btn.check.TextColor3 = isSelected and Accent or TextSecondary
                btn.label.TextColor3 = isSelected and TextPrimary or TextSecondary
            end
            DropBtn.Text = GetDisplayText()
        end
        
        for i, opt in ipairs(options) do
            local OptBtn = Instance.new("TextButton")
            OptBtn.Size = UDim2.new(1, -4, 0, 26)
            OptBtn.BackgroundColor3 = Color3.fromRGB(50, 55, 65)
            OptBtn.BackgroundTransparency = 1
            OptBtn.BorderSizePixel = 0
            OptBtn.Text = ""
            OptBtn.LayoutOrder = i
            OptBtn.ZIndex = 102
            OptBtn.Parent = DropScroll
            
            local OptCorner = Instance.new("UICorner")
            OptCorner.CornerRadius = UDim.new(0, 4)
            OptCorner.Parent = OptBtn
            
            local CheckLabel = Instance.new("TextLabel")
            CheckLabel.Size = UDim2.new(0, 20, 1, 0)
            CheckLabel.Position = UDim2.new(0, 4, 0, 0)
            CheckLabel.BackgroundTransparency = 1
            CheckLabel.Text = configTable[configKey][opt] and "✓" or ""
            CheckLabel.TextSize = 12
            CheckLabel.Font = Enum.Font.GothamBold
            CheckLabel.TextColor3 = configTable[configKey][opt] and Accent or TextSecondary
            CheckLabel.ZIndex = 103
            CheckLabel.Parent = OptBtn
            
            local OptLabel = Instance.new("TextLabel")
            OptLabel.Size = UDim2.new(1, -28, 1, 0)
            OptLabel.Position = UDim2.new(0, 24, 0, 0)
            OptLabel.BackgroundTransparency = 1
            OptLabel.Text = opt
            OptLabel.TextSize = 10
            OptLabel.Font = Enum.Font.GothamMedium
            OptLabel.TextColor3 = configTable[configKey][opt] and TextPrimary or TextSecondary
            OptLabel.TextXAlignment = Enum.TextXAlignment.Left
            OptLabel.ZIndex = 103
            OptLabel.Parent = OptBtn
            
            optionButtons[opt] = {btn = OptBtn, check = CheckLabel, label = OptLabel}
            
            OptBtn.MouseEnter:Connect(function()
                OptBtn.BackgroundTransparency = 0
            end)
            
            OptBtn.MouseLeave:Connect(function()
                OptBtn.BackgroundTransparency = 1
            end)
            
            OptBtn.MouseButton1Click:Connect(function()
                if opt == "Any" then
                    for k in pairs(configTable[configKey]) do
                        configTable[configKey][k] = nil
                    end
                    configTable[configKey]["Any"] = true
                else
                    configTable[configKey]["Any"] = nil
                    
                    if configTable[configKey][opt] then
                        configTable[configKey][opt] = nil
                    else
                        configTable[configKey][opt] = true
                    end
                    
                    local hasAny = false
                    for k, v in pairs(configTable[configKey]) do
                        if v then hasAny = true break end
                    end
                    if not hasAny then
                        configTable[configKey]["Any"] = true
                    end
                end
                
                UpdateOptionVisuals()
            end)
        end
        
        DropBtn.MouseButton1Click:Connect(function()
            if activeDropdown and activeDropdown ~= DropFrame then
                activeDropdown.Visible = false
            end
            
            if DropFrame.Visible then
                DropFrame.Visible = false
                activeDropdown = nil
                activeDropdownBtn = nil
            else
                local absPos = DropBtn.AbsolutePosition
                local absSize = DropBtn.AbsoluteSize
                DropFrame.Position = UDim2.new(0, absPos.X, 0, absPos.Y + absSize.Y + 4)
                DropFrame.Visible = true
                activeDropdown = DropFrame
                activeDropdownBtn = DropBtn
            end
        end)
        
        return Frame
    end
    
    CreateToggle(FarmingPanel, UDim2.new(0, 0, 0, 0), UDim2.new(0.5, -4, 0, 40), "Auto Collect", false, function(v)
        Config.AutoCollect = v
        if v then StartAutoCollect() else StopAutoCollect() end
    end)
    
    CreateToggle(FarmingPanel, UDim2.new(0.5, 4, 0, 0), UDim2.new(0.5, -4, 0, 40), "Auto Buy", false, function(v)
        Config.AutoBuyPacks = v
        if v then StartAutoBuyPacks() else StopAutoBuyPacks() end
    end)
    
    CreateSlider(FarmingPanel, UDim2.new(0, 0, 0, 46), UDim2.new(0.5, -4, 0, 50), "Collect Interval", 1, 10, 2, function(v)
        Config.CollectInterval = v
    end)
    
    CreateSlider(FarmingPanel, UDim2.new(0.5, 4, 0, 46), UDim2.new(0.5, -4, 0, 50), "Buy Delay", 0.5, 5, 2, function(v)
        Config.BuyDelay = v
    end)
    
    CreateToggle(FarmingPanel, UDim2.new(0, 0, 0, 102), UDim2.new(0.5, -4, 0, 50), "Auto Open", false, function(v)
        Config.AutoOpenPacks = v
        if v then StartAutoOpenPacks() else StopAutoOpenPacks() end
    end)
    
    CreateMultiDropdown(FarmingPanel, UDim2.new(0.5, 4, 0, 102), UDim2.new(0.5, -4, 0, 50), "Pack", ScanPackTypes(), Config, "SelectedPackTypes")
    
    local StatsRow = Instance.new("Frame")
    StatsRow.Size = UDim2.new(1, 0, 0, 40)
    StatsRow.Position = UDim2.new(0, 0, 0, 158)
    StatsRow.BackgroundColor3 = GlassCard
    StatsRow.BackgroundTransparency = 0.4
    StatsRow.BorderSizePixel = 0
    StatsRow.Parent = FarmingPanel
    
    local StatsCorner = Instance.new("UICorner")
    StatsCorner.CornerRadius = UDim.new(0, 8)
    StatsCorner.Parent = StatsRow
    
    local CollectedLabel = Instance.new("TextLabel")
    CollectedLabel.Size = UDim2.new(0.33, 0, 1, 0)
    CollectedLabel.Position = UDim2.new(0, 8, 0, 0)
    CollectedLabel.BackgroundTransparency = 1
    CollectedLabel.Text = "Collected: 0"
    CollectedLabel.TextSize = 11
    CollectedLabel.Font = Enum.Font.GothamMedium
    CollectedLabel.TextColor3 = TextPrimary
    CollectedLabel.TextXAlignment = Enum.TextXAlignment.Left
    CollectedLabel.Parent = StatsRow
    
    local BoughtLabel = Instance.new("TextLabel")
    BoughtLabel.Size = UDim2.new(0.33, 0, 1, 0)
    BoughtLabel.Position = UDim2.new(0.33, 0, 0, 0)
    BoughtLabel.BackgroundTransparency = 1
    BoughtLabel.Text = "Bought: 0"
    BoughtLabel.TextSize = 11
    BoughtLabel.Font = Enum.Font.GothamMedium
    BoughtLabel.TextColor3 = TextPrimary
    BoughtLabel.TextXAlignment = Enum.TextXAlignment.Center
    BoughtLabel.Parent = StatsRow
    
    local OpenedLabel = Instance.new("TextLabel")
    OpenedLabel.Size = UDim2.new(0.33, 0, 1, 0)
    OpenedLabel.Position = UDim2.new(0.66, 0, 0, 0)
    OpenedLabel.BackgroundTransparency = 1
    OpenedLabel.Text = "Opened: 0"
    OpenedLabel.TextSize = 11
    OpenedLabel.Font = Enum.Font.GothamMedium
    OpenedLabel.TextColor3 = TextPrimary
    OpenedLabel.TextXAlignment = Enum.TextXAlignment.Right
    OpenedLabel.Parent = StatsRow
    
    Threads["StatsUpdate"] = task.spawn(function()
        while State.Running and CollectedLabel and CollectedLabel.Parent do
            pcall(function()
                CollectedLabel.Text = "Collected: " .. FormatNumber(Stats.MoneyCollected)
                BoughtLabel.Text = "Bought: " .. FormatNumber(Stats.PacksBought)
                OpenedLabel.Text = "Opened: " .. FormatNumber(Stats.PacksOpened)
            end)
            task.wait(1)
        end
    end)
    
    local function CreateButton(parent, pos, size, text, callback)
        local Btn = Instance.new("TextButton")
        Btn.Size = size
        Btn.Position = pos
        Btn.BackgroundColor3 = GlassCard
        Btn.BackgroundTransparency = 0.4
        Btn.BorderSizePixel = 0
        Btn.Text = text
        Btn.TextSize = 12
        Btn.Font = Enum.Font.GothamMedium
        Btn.TextColor3 = TextPrimary
        Btn.Parent = parent
        
        local Corner = Instance.new("UICorner")
        Corner.CornerRadius = UDim.new(0, 8)
        Corner.Parent = Btn
        
        Btn.MouseEnter:Connect(function()
            TweenService:Create(Btn, TweenInfo.new(0.15), {BackgroundTransparency = 0.2}):Play()
        end)
        
        Btn.MouseLeave:Connect(function()
            TweenService:Create(Btn, TweenInfo.new(0.15), {BackgroundTransparency = 0.4}):Play()
        end)
        
        Btn.MouseButton1Click:Connect(callback)
        
        return Btn
    end
    
    CreateButton(ActionsPanel, UDim2.new(0, 0, 0, 0), UDim2.new(0.5, -4, 0, 40), "Collect All", function()
        task.spawn(function() CollectMoney(true) end)
    end)
    
    CreateButton(ActionsPanel, UDim2.new(0.5, 4, 0, 0), UDim2.new(0.5, -4, 0, 40), "Buy Pack", function()
        task.spawn(BuyPack)
    end)
    
    CreateButton(ActionsPanel, UDim2.new(0, 0, 0, 46), UDim2.new(0.5, -4, 0, 40), "Open Packs", function()
        task.spawn(OpenReadyPacks)
    end)
    
    CreateButton(ActionsPanel, UDim2.new(0.5, 4, 0, 46), UDim2.new(0.5, -4, 0, 40), "Refresh Slots", function()
        CachedSlots = {}
        LastSlotCache = 0
        GetAllSlots(true)
    end)
    
    local InfoRow = Instance.new("Frame")
    InfoRow.Size = UDim2.new(1, 0, 0, 36)
    InfoRow.Position = UDim2.new(0, 0, 0, 92)
    InfoRow.BackgroundColor3 = GlassCard
    InfoRow.BackgroundTransparency = 0.4
    InfoRow.BorderSizePixel = 0
    InfoRow.Parent = ActionsPanel
    
    local InfoCorner = Instance.new("UICorner")
    InfoCorner.CornerRadius = UDim.new(0, 8)
    InfoCorner.Parent = InfoRow
    
    local SlotsLabel = Instance.new("TextLabel")
    SlotsLabel.Size = UDim2.new(0.5, 0, 1, 0)
    SlotsLabel.Position = UDim2.new(0, 8, 0, 0)
    SlotsLabel.BackgroundTransparency = 1
    SlotsLabel.Text = "Slots: ..."
    SlotsLabel.TextSize = 11
    SlotsLabel.Font = Enum.Font.GothamMedium
    SlotsLabel.TextColor3 = TextPrimary
    SlotsLabel.TextXAlignment = Enum.TextXAlignment.Left
    SlotsLabel.Parent = InfoRow
    
    local PlotLabel = Instance.new("TextLabel")
    PlotLabel.Size = UDim2.new(0.5, -8, 1, 0)
    PlotLabel.Position = UDim2.new(0.5, 0, 0, 0)
    PlotLabel.BackgroundTransparency = 1
    PlotLabel.Text = "Plot: ..."
    PlotLabel.TextSize = 11
    PlotLabel.Font = Enum.Font.GothamMedium
    PlotLabel.TextColor3 = TextPrimary
    PlotLabel.TextXAlignment = Enum.TextXAlignment.Right
    PlotLabel.Parent = InfoRow
    
    Threads["InfoUpdate"] = task.spawn(function()
        while State.Running and SlotsLabel and SlotsLabel.Parent do
            pcall(function()
                local plot = GetPlayerPlot()
                local slots = GetAllSlots()
                SlotsLabel.Text = "Slots: " .. #slots
                PlotLabel.Text = "Plot: " .. (plot and plot.Name or "None")
            end)
            task.wait(2)
        end
    end)
    
    local dragging = false
    local dragStart, startPos
    
    local function StartDrag(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            dragStart = input.Position
            startPos = MainContainer.Position
        end
    end
    
    local function StopDrag(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = false
        end
    end
    
    TopBar.InputBegan:Connect(StartDrag)
    TopBar.InputEnded:Connect(StopDrag)
    
    MainContainer.InputBegan:Connect(StartDrag)
    MainContainer.InputEnded:Connect(StopDrag)
    
    Connections["Drag"] = UserInputService.InputChanged:Connect(function(input)
        if dragging and State.Running and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
            local delta = input.Position - dragStart
            MainContainer.Position = UDim2.new(
                startPos.X.Scale, startPos.X.Offset + delta.X,
                startPos.Y.Scale, startPos.Y.Offset + delta.Y
            )
        end
    end)
    
    if isMobile then
        local MobileToggle = Instance.new("TextButton")
        MobileToggle.Name = "MobileToggle"
        MobileToggle.Size = UDim2.new(0, 44, 0, 44)
        MobileToggle.Position = UDim2.new(1, -54, 0, 50)
        MobileToggle.BackgroundColor3 = GlassBg
        MobileToggle.BackgroundTransparency = 0.1
        MobileToggle.BorderSizePixel = 0
        MobileToggle.Text = "GUI"
        MobileToggle.TextSize = 14
        MobileToggle.Font = Enum.Font.GothamBold
        MobileToggle.TextColor3 = TextPrimary
        MobileToggle.Parent = ScreenGui
        
        local MobileCorner = Instance.new("UICorner")
        MobileCorner.CornerRadius = UDim.new(1, 0)
        MobileCorner.Parent = MobileToggle
        
        local MobileStroke = Instance.new("UIStroke")
        MobileStroke.Color = Accent
        MobileStroke.Thickness = 2
        MobileStroke.Parent = MobileToggle
        
        local visible = true
        local mobileDragging = false
        local mobileDragStart, mobileStartPos
        
        MobileToggle.MouseButton1Click:Connect(function()
            if not mobileDragging then
                visible = not visible
                MainContainer.Visible = visible
            end
        end)
        
        MobileToggle.InputBegan:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.Touch then
                mobileDragging = false
                mobileDragStart = input.Position
                mobileStartPos = MobileToggle.Position
            end
        end)
        
        MobileToggle.InputChanged:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.Touch then
                local delta = input.Position - mobileDragStart
                if delta.Magnitude > 10 then
                    mobileDragging = true
                    local screenSize = ScreenGui.AbsoluteSize
                    local btnSize = MobileToggle.AbsoluteSize
                    
                    local newX = math.clamp(mobileStartPos.X.Offset + delta.X, 10, screenSize.X - btnSize.X - 10)
                    local newY = math.clamp(mobileStartPos.Y.Offset + delta.Y, 50, screenSize.Y - btnSize.Y - 10)
                    
                    MobileToggle.Position = UDim2.new(0, newX, 0, newY)
                end
            end
        end)
        
        MobileToggle.InputEnded:Connect(function(input)
            if input.UserInputType == Enum.UserInputType.Touch then
                task.wait(0.1)
                mobileDragging = false
            end
        end)
    end
end

GetAllSlots(true)
CreateGUI()

getgenv().CardCollectionFarm = {
    Config = Config,
    State = State,
    Stats = Stats,
    Unload = Unload,
    CollectMoney = CollectMoney,
    BuyPack = BuyPack,
    OpenReadyPacks = OpenReadyPacks,
    GetPlayerPlot = GetPlayerPlot,
    GetAllSlots = GetAllSlots,
    RefreshSlots = function()
        CachedSlots = {}
        LastSlotCache = 0
        return GetAllSlots(true)
    end,
}

Features & Information

Tested on Ios Delta, Pot a ssium and xeno on windows. Open source You gotta stand a little closer to your wall to allow it to hit all slots. Open source do as you please with this. Features: Auto Collect (collects money from all cards on wall did not add pagination for this demo) Auto Buy (Filter by pack type (All types) Intelligently tracks your balance to only buy what you can afford Auto Open packs Mobile touch targets & sizing + gui open/close button
#my card collection#collect all#autobuy#money#mobile

Community Comments (1)

leetleetJan 16, 2026

This script was bugged it is now visible.