Description

This is an open source script code made by proto hub and you can collect the coins and candies automatically. anti AFK

Features

  • + Auto farm Candy
  • + Auto farm Coin
  • + ESP
  • + ANTI AFK

Supported Executors

Xeno Volt Potassium Wave Delta Solara Opiumware Codex MacSploit Vega X Velocity

Script

Add Xeno Scripts as a preferred source
if not game:IsLoaded() then
    game.Loaded:Wait()
end

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

while not LocalPlayer do
    task.wait()
    LocalPlayer = Players.LocalPlayer
end

local ConfigFileName = "PROTO_MM2_Config.json"
local ScriptFileName = "PROTO_Autorun.lua"

local Settings = {
    AutoFarmCoins = false,
    AutoFarmCandy = false,
    ESP = false,
    AutoExecute = true,
    TweenSpeed = 24
}

local CurrentTween = nil
local VisitedCoins = {}

-- ==========================================
-- 1. Config System (Save & Load)
-- ==========================================
local function SaveConfig()
    if writefile then
        pcall(function()
            local json = HttpService:JSONEncode(Settings)
            writefile(ConfigFileName, json)
        end)
    end
end

local function LoadConfig()
    if isfile and readfile and isfile(ConfigFileName) then
        pcall(function()
            local decoded = HttpService:JSONDecode(readfile(ConfigFileName))
            if type(decoded) == "table" then
                for k, v in pairs(decoded) do
                    if Settings[k] ~= nil then
                        Settings[k] = v
                    end
                end
            end
        end)
    end
end

LoadConfig()

-- ==========================================
-- 2. Auto Execute on Teleport System
-- ==========================================
local QueueTeleport = queue_on_teleport or (syn and syn.queue_on_teleport) or (fluxus and fluxus.queue_on_teleport)

local TeleportQueued = false
LocalPlayer.OnTeleport:Connect(function(State)
    if Settings.AutoExecute and not TeleportQueued and QueueTeleport then
        TeleportQueued = true
        pcall(function()
            if isfile and isfile(ScriptFileName) then
                QueueTeleport('if readfile and isfile("' .. ScriptFileName .. '") then loadstring(readfile("' .. ScriptFileName .. '"))() end')
            elseif _G.PROTO_ScriptSource then
                QueueTeleport(_G.PROTO_ScriptSource)
            end
        end)
    end
end)

-- ==========================================
-- 3. PROTO Halloween UI
-- ==========================================
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
if PlayerGui:FindFirstChild("PROTO_Halloween_UI") then
    PlayerGui.PROTO_Halloween_UI:Destroy()
end

local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "PROTO_Halloween_UI"
ScreenGui.ResetOnSpawn = false
ScreenGui.Parent = PlayerGui

local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(0, 220, 0, 260)
MainFrame.Position = UDim2.new(0.5, -110, 0.3, 0)
MainFrame.BackgroundColor3 = Color3.fromRGB(18, 12, 24)
MainFrame.BorderSizePixel = 0
MainFrame.Active = true
MainFrame.Draggable = true
MainFrame.Parent = ScreenGui

local MainCorner = Instance.new("UICorner")
MainCorner.CornerRadius = UDim.new(0, 12)
MainCorner.Parent = MainFrame

local MainStroke = Instance.new("UIStroke")
MainStroke.Color = Color3.fromRGB(255, 105, 0)
MainStroke.Thickness = 2
MainStroke.Parent = MainFrame

local TitleBar = Instance.new("Frame")
TitleBar.Size = UDim2.new(1, 0, 0, 36)
TitleBar.BackgroundColor3 = Color3.fromRGB(32, 20, 44)
TitleBar.BorderSizePixel = 0
TitleBar.Parent = MainFrame

local TitleCorner = Instance.new("UICorner")
TitleCorner.CornerRadius = UDim.new(0, 12)
TitleCorner.Parent = TitleBar

local TitleLabel = Instance.new("TextLabel")
TitleLabel.Size = UDim2.new(1, -40, 1, 0)
TitleLabel.Position = UDim2.new(0, 12, 0, 0)
TitleLabel.BackgroundTransparency = 1
TitleLabel.Text = "🎃 PROTO"
TitleLabel.TextColor3 = Color3.fromRGB(255, 130, 20)
TitleLabel.Font = Enum.Font.GothamBold
TitleLabel.TextSize = 15
TitleLabel.TextXAlignment = Enum.TextXAlignment.Left
TitleLabel.Parent = TitleBar

local MinimizeBtn = Instance.new("TextButton")
MinimizeBtn.Size = UDim2.new(0, 28, 0, 28)
MinimizeBtn.Position = UDim2.new(1, -32, 0, 4)
MinimizeBtn.BackgroundColor3 = Color3.fromRGB(255, 105, 0)
MinimizeBtn.Text = "-"
MinimizeBtn.TextColor3 = Color3.fromRGB(18, 12, 24)
MinimizeBtn.Font = Enum.Font.GothamBold
MinimizeBtn.TextSize = 16
MinimizeBtn.Parent = TitleBar

local MinCorner = Instance.new("UICorner")
MinCorner.CornerRadius = UDim.new(0, 8)
MinCorner.Parent = MinimizeBtn

local ContentFrame = Instance.new("Frame")
ContentFrame.Size = UDim2.new(1, -20, 1, -48)
ContentFrame.Position = UDim2.new(0, 10, 0, 42)
ContentFrame.BackgroundTransparency = 1
ContentFrame.Parent = MainFrame

local UIListLayout = Instance.new("UIListLayout")
UIListLayout.Padding = UDim.new(0, 10)
UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
UIListLayout.Parent = ContentFrame

local function CreateToggle(text, settingKey)
    local Btn = Instance.new("TextButton")
    Btn.Size = UDim2.new(1, 0, 0, 42)
    Btn.Font = Enum.Font.GothamSemibold
    Btn.TextSize = 13
    Btn.AutoButtonColor = false
    Btn.Parent = ContentFrame

    local BtnCorner = Instance.new("UICorner")
    BtnCorner.CornerRadius = UDim.new(0, 8)
    BtnCorner.Parent = Btn

    local BtnStroke = Instance.new("UIStroke")
    BtnStroke.Thickness = 1.2
    BtnStroke.Parent = Btn

    local function UpdateVisualState()
        if Settings[settingKey] then
            Btn.Text = text .. " : ON"
            Btn.BackgroundColor3 = Color3.fromRGB(255, 105, 0)
            Btn.TextColor3 = Color3.fromRGB(18, 12, 24)
            BtnStroke.Color = Color3.fromRGB(255, 160, 60)
        else
            Btn.Text = text .. " : OFF"
            Btn.BackgroundColor3 = Color3.fromRGB(30, 22, 38)
            Btn.TextColor3 = Color3.fromRGB(220, 220, 220)
            BtnStroke.Color = Color3.fromRGB(70, 50, 90)
        end
    end

    UpdateVisualState()

    Btn.MouseButton1Click:Connect(function()
        Settings[settingKey] = not Settings[settingKey]
        UpdateVisualState()
        SaveConfig()

        if not Settings[settingKey] and (settingKey == "AutoFarmCoins" or settingKey == "AutoFarmCandy") and CurrentTween then
            CurrentTween:Cancel()
            CurrentTween = nil
        end
    end)
end

CreateToggle("🪙 Auto Farm Coins", "AutoFarmCoins")
CreateToggle("🍬 Auto Farm Candy", "AutoFarmCandy")
CreateToggle("👻 Role ESP", "ESP")
CreateToggle("⚡ Auto Execute", "AutoExecute")

local minimized = false
MinimizeBtn.MouseButton1Click:Connect(function()
    minimized = not minimized
    ContentFrame.Visible = not minimized
    if minimized then
        MainFrame:TweenSize(UDim2.new(0, 220, 0, 36), "Out", "Quad", 0.25, true)
        MinimizeBtn.Text = "+"
    else
        MainFrame:TweenSize(UDim2.new(0, 220, 0, 260), "Out", "Quad", 0.25, true)
        MinimizeBtn.Text = "-"
    end
end)

-- ==========================================
-- 4. Role ESP Logic
-- ==========================================
local function GetPlayerRoleColor(player)
    local character = player.Character
    local backpack = player:FindFirstChild("Backpack")

    local function hasTool(toolName)
        return (character and character:FindFirstChild(toolName)) or (backpack and backpack:FindFirstChild(toolName))
    end

    if hasTool("Knife") then
        return Color3.fromRGB(255, 45, 45)
    elseif hasTool("Gun") then
        return Color3.fromRGB(45, 140, 255)
    else
        return Color3.fromRGB(60, 230, 100)
    end
end

local function UpdateESP()
    for _, player in ipairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and player.Character then
            local highlight = player.Character:FindFirstChild("PROTO_ESP")
            if Settings.ESP then
                if not highlight then
                    highlight = Instance.new("Highlight")
                    highlight.Name = "PROTO_ESP"
                    highlight.FillTransparency = 0.5
                    highlight.OutlineTransparency = 0
                    highlight.Parent = player.Character
                end
                local roleColor = GetPlayerRoleColor(player)
                highlight.FillColor = roleColor
                highlight.OutlineColor = roleColor
            else
                if highlight then
                    highlight:Destroy()
                end
            end
        end
    end
end

-- ==========================================
-- 5. Auto Farm (Coins & Candy)
-- ==========================================
local function FindCoinContainer()
    for _, child in ipairs(workspace:GetChildren()) do
        local container = child:FindFirstChild("CoinContainer")
        if container then
            return container
        end
    end
    return workspace:FindFirstChild("CoinContainer", true)
end

local function GetValidCoinPart(item)
    if VisitedCoins[item] then return nil end

    local visual = item:FindFirstChild("CoinVisual")
    if visual and visual:IsA("BasePart") then
        if visual.Transparency > 0.5 then return nil end
        return visual
    end

    if item:IsA("BasePart") then
        if item.Transparency > 0.5 then return nil end
        return item
    elseif item:IsA("Model") then
        local part = item.PrimaryPart or item:FindFirstChildWhichIsA("BasePart")
        if part and part.Transparency <= 0.5 then
            return part
        end
    end
    return nil
end

local function GetNearestCollectible(container)
    local character = LocalPlayer.Character
    local rootPart = character and character:FindFirstChild("HumanoidRootPart")
    if not rootPart or not container then return nil, nil, nil end

    local nearestPart = nil
    local nearestItem = nil
    local shortestDist = math.huge

    for _, item in ipairs(container:GetChildren()) do
        local targetPart = GetValidCoinPart(item)
        if targetPart then
            local dist = (rootPart.Position - targetPart.Position).Magnitude
            if dist < shortestDist and dist < 300 then
                shortestDist = dist
                nearestPart = targetPart
                nearestItem = item
            end
        end
    end
    return nearestPart, nearestItem, shortestDist
end

RunService.Stepped:Connect(function()
    if (Settings.AutoFarmCoins or Settings.AutoFarmCandy) and LocalPlayer.Character then
        local rootPart = LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
        if rootPart then
            rootPart.Velocity = Vector3.zero
            rootPart.RotVelocity = Vector3.zero
        end
        for _, part in ipairs(LocalPlayer.Character:GetDescendants()) do
            if part:IsA("BasePart") and part.CanCollide then
                part.CanCollide = false
            end
        end
    end
end)

task.spawn(function()
    while task.wait(0.3) do
        UpdateESP()
    end
end)

task.spawn(function()
    while task.wait(0.1) do
        if Settings.AutoFarmCoins or Settings.AutoFarmCandy then
            local character = LocalPlayer.Character
            local rootPart = character and character:FindFirstChild("HumanoidRootPart")
            local humanoid = character and character:FindFirstChildOfClass("Humanoid")
            local container = FindCoinContainer()

            if rootPart and humanoid and humanoid.Health > 0 and container then
                local targetPart, targetItem, dist = GetNearestCollectible(container)
                if targetPart and targetItem and dist then
                    local duration = math.clamp(dist / Settings.TweenSpeed, 0.05, 5)
                    local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear)

                    CurrentTween = TweenService:Create(rootPart, tweenInfo, {
                        CFrame = CFrame.new(targetPart.Position)
                    })
                    CurrentTween:Play()

                    local startTime = tick()
                    while CurrentTween and CurrentTween.PlaybackState == Enum.PlaybackState.Playing do
                        if not (Settings.AutoFarmCoins or Settings.AutoFarmCandy) then
                            CurrentTween:Cancel()
                            break
                        end
                        if not targetItem.Parent or targetPart.Transparency > 0.5 or (tick() - startTime) > (duration + 0.5) then
                            CurrentTween:Cancel()
                            break
                        end
                        task.wait(0.05)
                    end

                    VisitedCoins[targetItem] = true
                    task.delay(3, function()
                        VisitedCoins[targetItem] = nil
                    end)
                    task.wait(0.12)
                end
            else
                VisitedCoins = {}
            end
        end
    end
end)
Script worked? 🚀 Boost it to #1 so others find it too.

Comments (0)

Log in to add a comment.