CCCPaste

Fragrama and Chocrama auto buy / #roblox__ego...

-- FragramaChocrama v5 (final)
-- 50 clics/s, recherche multiple, activation multiple, draggable toggle
-- Debug: Attempts / Last found / Last method / History (10 dernières tentatives)
-- Le même bouton spamBtn démarre/arrête le spam

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

-- Parent du GUI : CoreGui si possible, sinon PlayerGui
local parentGui
pcall(function() parentGui = game:GetService("CoreGui") end)
if not (parentGui and parentGui:IsA("Instance")) then
    parentGui = LocalPlayer:WaitForChild("PlayerGui")
end

-- Création du ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "FragramaChocrama_MainGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = parentGui

-- Utilitaire : rendre un GUI draggable (souris + tactile)
local function makeDraggable(guiObject)
    local dragging = false
    local dragInput
    local dragStart
    local startPos

    local function update(input)
        local delta = input.Position - dragStart
        guiObject.Position = UDim2.new(
            math.clamp(startPos.X.Scale, 0, 1),
            math.clamp(startPos.X.Offset + delta.X, -10000, 10000),
            math.clamp(startPos.Y.Scale, 0, 1),
            math.clamp(startPos.Y.Offset + delta.Y, -10000, 10000)
        )
    end

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

            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then
                    dragging = false
                end
            end)
        end
    end)

    guiObject.InputChanged:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseMovement or
           input.UserInputType == Enum.UserInputType.Touch then
            dragInput = input
        end
    end)

    UserInputService.InputChanged:Connect(function(input)
        if input == dragInput and dragging then
            pcall(update, input)
        end
    end)
end

-- Utilitaire : obtenir un chemin lisible pour un Instance
local function getInstancePath(inst)
    if not inst or not inst:IsA("Instance") then return "nil" end
    local parts = {}
    local current = inst
    while current do
        table.insert(parts, 1, current.Name or tostring(current.ClassName))
        current = current.Parent
    end
    return table.concat(parts, "/")
end

-- UI : toggle draggable (container)
local toggleContainer = Instance.new("Frame")
toggleContainer.Size = UDim2.new(0, 160, 0, 36)
toggleContainer.Position = UDim2.new(0.02, 0, 0.80, 0)
toggleContainer.AnchorPoint = Vector2.new(0,0)
toggleContainer.BackgroundColor3 = Color3.fromRGB(40,40,40)
toggleContainer.BorderSizePixel = 0
toggleContainer.Parent = screenGui

local toggleVisibilityBtn = Instance.new("TextButton")
toggleVisibilityBtn.Size = UDim2.new(1, -6, 1, -6)
toggleVisibilityBtn.Position = UDim2.new(0, 3, 0, 3)
toggleVisibilityBtn.Text = "Show GUI"
toggleVisibilityBtn.Font = Enum.Font.SourceSansBold
toggleVisibilityBtn.TextSize = 16
toggleVisibilityBtn.BackgroundTransparency = 1
toggleVisibilityBtn.TextColor3 = Color3.fromRGB(230,230,230)
toggleVisibilityBtn.Parent = toggleContainer
toggleVisibilityBtn.AutoButtonColor = true

makeDraggable(toggleContainer)

-- Menu (initialement caché)
local menuFrame = Instance.new("Frame")
menuFrame.Size = UDim2.new(0, 420, 0, 140)
menuFrame.Position = UDim2.new(0.02, 0, 0.60, 0)
menuFrame.BackgroundTransparency = 0.12
menuFrame.BackgroundColor3 = Color3.fromRGB(20,20,20)
menuFrame.BorderSizePixel = 0
menuFrame.Visible = false
menuFrame.Parent = screenGui

local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, -10, 0, 24)
title.Position = UDim2.new(0, 5, 0, 5)
title.BackgroundTransparency = 1
title.Text = "Menu Fragrama"
title.Font = Enum.Font.SourceSansBold
title.TextSize = 16
title.TextXAlignment = Enum.TextXAlignment.Left
title.TextColor3 = Color3.fromRGB(220,220,220)
title.Parent = menuFrame

local spamBtn = Instance.new("TextButton")
spamBtn.Size = UDim2.new(0, 220, 0, 40)
spamBtn.Position = UDim2.new(0, 5, 0, 36)
spamBtn.Text = "Fragrama and Chocrama"
spamBtn.Font = Enum.Font.SourceSansBold
spamBtn.TextSize = 16
spamBtn.Parent = menuFrame
spamBtn.AutoButtonColor = true

local statusLabel = Instance.new("TextLabel")
statusLabel.Size = UDim2.new(0, 180, 0, 18)
statusLabel.Position = UDim2.new(0, 235, 0, 46)
statusLabel.BackgroundTransparency = 1
statusLabel.Text = "OFF"
statusLabel.Font = Enum.Font.SourceSans
statusLabel.TextSize = 14
statusLabel.TextXAlignment = Enum.TextXAlignment.Left
statusLabel.TextColor3 = Color3.fromRGB(200,200,200)
statusLabel.Parent = menuFrame

-- Debug frame (Attempts / Last / Method / History)
local debugFrame = Instance.new("Frame")
debugFrame.Size = UDim2.new(0, 410, 0, 70)
debugFrame.Position = UDim2.new(0, 5, 0, 82)
debugFrame.BackgroundTransparency = 0.2
debugFrame.BackgroundColor3 = Color3.fromRGB(15,15,15)
debugFrame.BorderSizePixel = 0
debugFrame.Parent = menuFrame

local attemptsLabel = Instance.new("TextLabel")
attemptsLabel.Size = UDim2.new(0, 200, 0, 18)
attemptsLabel.Position = UDim2.new(0, 6, 0, 4)
attemptsLabel.BackgroundTransparency = 1
attemptsLabel.Text = "Attempts: 0"
attemptsLabel.Font = Enum.Font.SourceSans
attemptsLabel.TextSize = 14
attemptsLabel.TextXAlignment = Enum.TextXAlignment.Left
attemptsLabel.TextColor3 = Color3.fromRGB(200,200,200)
attemptsLabel.Parent = debugFrame

local lastMethodLabel = Instance.new("TextLabel")
lastMethodLabel.Size = UDim2.new(0, 200, 0, 18)
lastMethodLabel.Position = UDim2.new(0, 210, 0, 4)
lastMethodLabel.BackgroundTransparency = 1
lastMethodLabel.Text = "Last method: -"
lastMethodLabel.Font = Enum.Font.SourceSans
lastMethodLabel.TextSize = 14
lastMethodLabel.TextXAlignment = Enum.TextXAlignment.Left
lastMethodLabel.TextColor3 = Color3.fromRGB(200,200,200)
lastMethodLabel.Parent = debugFrame

local lastFoundLabel = Instance.new("TextLabel")
lastFoundLabel.Size = UDim2.new(1, -10, 0, 18)
lastFoundLabel.Position = UDim2.new(0, 6, 0, 24)
lastFoundLabel.BackgroundTransparency = 1
lastFoundLabel.Text = "Last: Not found"
lastFoundLabel.Font = Enum.Font.SourceSans
lastFoundLabel.TextSize = 14
lastFoundLabel.TextXAlignment = Enum.TextXAlignment.Left
lastFoundLabel.TextColor3 = Color3.fromRGB(200,200,200)
lastFoundLabel.Parent = debugFrame

local historyLabel = Instance.new("TextLabel")
historyLabel.Size = UDim2.new(1, -10, 0, 24)
historyLabel.Position = UDim2.new(0, 6, 0, 44)
historyLabel.BackgroundTransparency = 1
historyLabel.Text = "History:"
historyLabel.Font = Enum.Font.SourceSans
historyLabel.TextSize = 13
historyLabel.TextXAlignment = Enum.TextXAlignment.Left
historyLabel.TextYAlignment = Enum.TextYAlignment.Top
historyLabel.TextWrapped = true
historyLabel.ClipsDescendants = true
historyLabel.TextColor3 = Color3.fromRGB(200,200,200)
historyLabel.Parent = debugFrame

-- Etat et variables pour spam / debug
local spamming = false
local spamCoroutine = nil
local attemptCounter = 0
local lastFoundInstance = nil
local lastMethodUsed = "-"
local history = {} -- table of strings, newest first
local historyMax = 10
local debugUpdateInterval = 0.1 -- UI update interval

-- Heuristiques de détection (comme avant)
local function isCandidateButton(inst)
    if not inst or not inst:IsA("Instance") then return false end

    if inst:IsA("TextButton") or inst:IsA("ImageButton") then
        if inst:IsA("TextButton") and inst.Text and inst.Text ~= "" then
            local txt = tostring(inst.Text)
            if txt:find("%$%s*40%s*[Bb]") or txt:lower():find("40b") or txt:lower():find("40 b") then
                return true
            end
            if txt:lower():find("buy") and txt:lower():find("40") then
                return true
            end
        end

        for _, d in ipairs(inst:GetDescendants()) do
            if d:IsA("TextLabel") or d:IsA("TextButton") then
                if d.Text and d.Text ~= "" then
                    local txt = tostring(d.Text)
                    if txt:find("%$%s*40%s*[Bb]") or txt:lower():find("40b") or txt:lower():find("buy") then
                        return true
                    end
                end
            end
        end

        if inst.Name and (inst.Name:lower():find("40") or inst.Name:lower():find("buy")) then
            return true
        end
    end

    if inst:IsA("TextLabel") and inst.Text and inst.Text ~= "" then
        local txt = tostring(inst.Text)
        if txt:find("%$%s*40%s*[Bb]") or txt:lower():find("40b") or txt:lower():find("buy") then
            return true
        end
    end

    if inst:IsA("ImageLabel") or inst:IsA("ImageButton") then
        for _, d in ipairs(inst:GetDescendants()) do
            if d:IsA("TextLabel") or d:IsA("TextButton") then
                if d.Text and d.Text ~= "" then
                    local txt = tostring(d.Text)
                    if txt:find("%$%s*40%s*[Bb]") or txt:lower():find("40b") or txt:lower():find("buy") then
                        return true
                    end
                end
            end
        end
    end

    if inst:IsA("ClickDetector") or inst:IsA("ProximityPrompt") then
        if inst.Parent and inst.Parent.Name and (inst.Parent.Name:lower():find("40") or inst.Parent.Name:lower():find("buy") or inst.Parent.Name:lower():find("purchase")) then
            return true
        end
        if inst:IsA("ProximityPrompt") then
            local a = tostring(inst.ActionText or "")
            local o = tostring(inst.ObjectText or "")
            if a:lower():find("40") or o:lower():find("40") or a:lower():find("buy") or o:lower():find("buy") then
                return true
            end
        end
    end

    return false
end

-- Recherche robuste
local function findBuyButton()
    local places = {}
    pcall(function() table.insert(places, LocalPlayer:WaitForChild("PlayerGui")) end)
    pcall(function() table.insert(places, game:GetService("CoreGui")) end)
    pcall(function() table.insert(places, workspace)) end
    pcall(function() table.insert(places, game:GetService("StarterGui")) end)
    pcall(function() table.insert(places, game:GetService("ReplicatedFirst")) end)

    for _, container in ipairs(places) do
        if container and container:IsA("Instance") then
            for _, inst in ipairs(container:GetDescendants()) do
                local ok, res = pcall(isCandidateButton, inst)
                if ok and res then
                    return inst
                end
            end
        end
    end

    -- dernier recours : recherche par nom
    local namePatterns = {"$40B", "40B", "40 b", "40", "buy", "purchase", "buy40"}
    for _, container in ipairs(places) do
        if container and container:IsA("Instance") then
            for _, inst in ipairs(container:GetDescendants()) do
                for _, pat in ipairs(namePatterns) do
                    if inst.Name and inst.Name:lower():find(pat:lower()) then
                        return inst
                    end
                end
            end
        end
    end

    return nil
end

-- Méthodes d'activation multiples
-- Retourne (success:boolean, method:string)
local function tryActivateButton(btn)
    if not btn or not btn.Parent then return false, "invalid" end

    -- 1) :Activate()
    local ok = false
    pcall(function() ok = btn:Activate() or true end)
    if ok then return true, ":Activate()" end

    -- 2) MouseButton1Click:Fire()
    local fired = false
    pcall(function()
        if btn.MouseButton1Click and typeof(btn.MouseButton1Click.Fire) == "function" then
            btn.MouseButton1Click:Fire()
            fired = true
        end
    end)
    if fired then return true, "MouseButton1Click:Fire()" end

    -- 3) getconnections sur Activated / MouseButton1Click
    if type(getconnections) == "function" then
        local function tryFireEvent(ev)
            local successLocal = false
            local okConns = {}
            pcall(function() okConns = getconnections(ev) end)
            for _, c in ipairs(okConns or {}) do
                pcall(function() c.Function() end)
                successLocal = true
            end
            return successLocal
        end

        local evFired = false
        pcall(function()
            if btn.Activated then
                if tryFireEvent(btn.Activated) then evFired = true end
            end
            if btn.MouseButton1Click then
                if tryFireEvent(btn.MouseButton1Click) then evFired = true end
            end
        end)

        if evFired then return true, "getconnections()" end
    end

    -- 4) ProximityPrompt / ClickDetector handling
    if btn:IsA("ProximityPrompt") then
        pcall(function() btn:InputHoldBegin() end)
        pcall(function() btn:InputHoldEnd() end)
        return true, "ProximityPrompt"
    end
    if btn:IsA("ClickDetector") then
        if type(fireclickdetector) == "function" then
            pcall(function() fireclickdetector(btn) end)
            return true, "fireclickdetector()"
        end
    end

    -- 5) Tentative : simuler InputBegan (exploit-specific)
    local simulated = false
    pcall(function()
        if btn.InputBegan then
            local fake = {
                UserInputType = Enum.UserInputType.MouseButton1,
                Position = Vector2.new(0,0),
                UserInputState = Enum.UserInputState.Begin
            }
            -- certains environnements permettent Fire; protégé en pcall
            pcall(function() btn.InputBegan:Fire(fake) end)
            simulated = true
        end
    end)
    if simulated then return true, "InputBegan:Fire()" end

    -- 6) Rien d'autre fonctionne
    return false, "none"
end

-- Ajoute une entrée dans l'historique (nouveau au début), garde max historyMax
local function pushHistory(entry)
    table.insert(history, 1, entry)
    if #history > historyMax then
        for i = historyMax+1, #history do
            history[i] = nil
        end
    end
end

-- Spam loop — 50 clics/s => wait(0.02)
local function spamLoop()
    while spamming do
        attemptCounter = attemptCounter + 1
        local btn = findBuyButton()
        lastFoundInstance = btn
        if btn then
            local success, method = pcall(function() return tryActivateButton(btn) end)
            local ok, usedMethod
            if success then
                ok, usedMethod = tryActivateButton(btn)
            else
                ok = false
                usedMethod = "error"
            end

            if ok then
                lastMethodUsed = usedMethod or "unknown"
                local name = "[" .. tostring(btn.ClassName) .. "] " .. tostring(btn.Name)
                local path = getInstancePath(btn)
                pushHistory("[" .. lastMethodUsed .. "] " .. name)
            else
                lastMethodUsed = usedMethod or "none"
                pushHistory("[fail] " .. (btn.Name or "unknown"))
            end
        else
            lastMethodUsed = "Not found"
            pushHistory("[fail] Not found")
        end
        -- tempo pour 50 clics/sec
        wait(0.02)
    end
end

-- Coroutine de mise à jour debug (toutes les 0.1s)
spawn(function()
    while true do
        attemptsLabel.Text = "Attempts: " .. tostring(attemptCounter)
        lastMethodLabel.Text = "Last method: " .. tostring(lastMethodUsed)
        if lastFoundInstance and lastFoundInstance:IsA("Instance") then
            local nm = "[" .. tostring(lastFoundInstance.ClassName) .. "] " .. tostring(lastFoundInstance.Name)
            local path = getInstancePath(lastFoundInstance)
            lastFoundLabel.Text = "Last: " .. nm .. "  |  " .. path
        else
            lastFoundLabel.Text = "Last: Not found"
        end

        -- Construire texte history (les N dernières)
        local histText = "History:"
        for i = 1, math.min(#history, historyMax) do
            histText = histText .. "\n" .. tostring(history[i])
        end
        historyLabel.Text = histText

        wait(debugUpdateInterval)
    end
end)

-- Handler du bouton spam (start/stop) — même bouton pour démarrer / arrêter
spamBtn.MouseButton1Click:Connect(function()
    spamming = not spamming
    statusLabel.Text = spamming and "ON" or "OFF"
    if spamming then
        if not spamCoroutine or coroutine.status(spamCoroutine) == "dead" then
            spamCoroutine = coroutine.create(function() spamLoop() end)
            coroutine.resume(spamCoroutine)
        end
    end
end)

-- Show/Hide menu
local visible = false
toggleVisibilityBtn.MouseButton1Click:Connect(function()
    visible = not visible
    menuFrame.Visible = visible
    toggleVisibilityBtn.Text = visible and "Hide GUI" or "Show GUI"
end)

-- Hover textes
spamBtn.MouseEnter:Connect(function() spamBtn.Text = "Clique pour toggle spam ($40B)" end)
spamBtn.MouseLeave:Connect(function() spamBtn.Text = "Fragrama and Chocrama" end)

print("[FragramaChocrama v5] Chargé — debug complet (Attempts / Last / Method / History).")