Build A Boat For Treasure Script Roblox – Updated Today

PUBLISHEDUPDATED
What changed
  • 2026-11-14 — Added Script #24: Feature List & More.
  • 2026-11-14 — Added Script #23: Auto Farm & More.
  • 2026-11-13 — Added Script #22: Working Script.
  • 2026-11-13 — Added Script #21: BABFT.
  • 2026-11-13 — Added Script #20: Reset Session Statistics Button & More.
  • 2026-11-11 — Added Script #19: kilong the goat & More.
  • 2026-11-11 — Added Script #18: Auto Farm Gold & More.
  • 2026-11-10 — Added Script #17: Unanchored Blocks Spawner & More.
  • 2026-11-10 — Added Script #16: Search Tags (Ignore) & More.
  • 2026-11-07 — Added Script #15: Open Source.
  • 2026-11-06 — Added Script #14: gets around 10-30k gold an hour & More.
  • 2026-11-02 — Added Script #13: Egg Cannon build a boat 2026 work & More.
  • 2026-11-02 — Added Script #12: OP GOLD FARM OP CANDY FARM OP FLY OP GOD MODE AND NOCLIP OP! & More.
  • 2026-11-01 — Added Script #11: Auto Farm Golds & More.
  • 2026-10-31 — Added Script #10: TESTED in Potassium & More.
Verified Working1 Active Script100% Free

Looking for a Build A Boat For Treasure script for Roblox? This page covers Auto Farm and Anti-AFK, plus a quick look at the game before you get to the code.

Build A Boat For Treasure starts with a simple plan: build your ship and set sail. Putting a boat together is the creative part. Heading out again and again for treasure is where the grind kicks in. A floating box still counts as a ship, right?

Auto Farm focuses on the farming grind, while Anti-AFK helps prevent idle kicks. If those are the two features you’re after, check out the Build A Boat For Treasure code below.

Build A Boat For Treasure Script – Auto Farm & More

Auto Farm & MoreFree
Auto FarmAnti-AFK
local workspace = game:GetService("Workspace")
local runService = game:GetService("RunService")
local players = game:GetService("Players")
local coreGui = game:GetService("CoreGui")
local localPlayer = players.LocalPlayer
local TweenService = game:GetService("TweenService")
local SoundService = game:GetService("SoundService")
local StarterGui = game:GetService("StarterGui")
local HttpService = game:GetService("HttpService")
local lighting = game:GetService("Lighting")
local virtualUser = game:GetService("VirtualUser")

-- ============================================
-- ANTI-AFK
-- ============================================
local antiAFKConnection
local function iniciarAntiAFK()
    antiAFKConnection = localPlayer.Idled:Connect(function()
        virtualUser:Button2Down(Vector2.new(0, 0), workspace.CurrentCamera.CFrame)
        task.wait(1)
        virtualUser:Button2Up(Vector2.new(0, 0), workspace.CurrentCamera.CFrame)
    end)
end
iniciarAntiAFK()

-- ============================================
-- ANTI-BAN (Anti-Report / Anti-Detection)
-- ============================================
local function iniciarAntiBan()
    -- Anti-report: evita que otros jugadores te reporten facilmente
    local function antiReport()
        for _, player in ipairs(players:GetPlayers()) do
            if player ~= localPlayer then
                local success, err = pcall(function()
                    local character = player.Character
                    if character then
                        -- Ocultar tu nombre de la lista de jugadores remotos
                        local humanoid = character:FindFirstChildOfClass("Humanoid")
                        if humanoid then
                            humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
                        end
                    end
                end)
            end
        end
    end

    -- Anti-detection basica
    local originalName = localPlayer.Name
    local function spoofName()
        pcall(function()
            -- Spoof del nombre en el localplayer (limitado pero util)
            localPlayer.DisplayName = "Player_" .. tostring(math.random(1000, 9999))
        end)
    end

    task.spawn(function()
        while task.wait(5) do
            antiReport()
            spoofName()
        end
    end)

    -- Anti-kick basico
    local mt = getrawmetatable and getrawmetatable(game) or nil
    if mt then
        local oldNamecall
        oldNamecall = hookmetamethod(game, "__namecall", function(self, ...)
            local method = getnamecallmethod()
            if method == "Kick" and self == localPlayer then
                return warn("[AntiBan] Kick attempt blocked!")
            end
            return oldNamecall(self, ...)
        end)
    end
end
iniciarAntiBan()

-- ============================================
-- SISTEMA DE NOTIFICACIONES
-- ============================================
local notifGui = Instance.new("ScreenGui")
notifGui.Name = "GZSSF_Notifications"
notifGui.ResetOnSpawn = false
local successNotif = pcall(function() notifGui.Parent = coreGui end)
if not successNotif then notifGui.Parent = localPlayer:WaitForChild("PlayerGui") end

local notifContainer = Instance.new("Frame")
notifContainer.Size = UDim2.new(0, 300, 0, 0)
notifContainer.Position = UDim2.new(1, -320, 0, 20)
notifContainer.BackgroundTransparency = 1
notifContainer.Parent = notifGui

local notifLayout = Instance.new("UIListLayout")
notifLayout.Padding = UDim.new(0, 8)
notifLayout.HorizontalAlignment = Enum.HorizontalAlignment.Right
notifLayout.VerticalAlignment = Enum.VerticalAlignment.Top
notifLayout.SortOrder = Enum.SortOrder.LayoutOrder
notifLayout.Parent = notifContainer

local function crearNotificacion(titulo, mensaje, tipo)
    local colores = {
        exito = Color3.fromRGB(100, 255, 100),
        error = Color3.fromRGB(255, 80, 80),
        info = Color3.fromRGB(150, 150, 150),
        advertencia = Color3.fromRGB(200, 200, 200)
    }
    local color = colores[tipo] or colores.info

    local notifFrame = Instance.new("Frame")
    notifFrame.Size = UDim2.new(0, 280, 0, 70)
    notifFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
    notifFrame.BackgroundTransparency = 0.2
    notifFrame.BorderSizePixel = 0
    notifFrame.LayoutOrder = -tick()
    notifFrame.Parent = notifContainer

    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0, 8)
    corner.Parent = notifFrame

    local stroke = Instance.new("UIStroke")
    stroke.Color = color
    stroke.Thickness = 1
    stroke.Transparency = 0.5
    stroke.Parent = notifFrame

    local barra = Instance.new("Frame")
    barra.Size = UDim2.new(0, 3, 1, 0)
    barra.BackgroundColor3 = color
    barra.BorderSizePixel = 0
    barra.Parent = notifFrame

    local cornerBarra = Instance.new("UICorner")
    cornerBarra.CornerRadius = UDim.new(0, 8)
    cornerBarra.Parent = barra

    local tituloLabel = Instance.new("TextLabel")
    tituloLabel.Size = UDim2.new(1, -20, 0, 22)
    tituloLabel.Position = UDim2.new(0, 12, 0, 5)
    tituloLabel.BackgroundTransparency = 1
    tituloLabel.Text = titulo
    tituloLabel.TextColor3 = color
    tituloLabel.Font = Enum.Font.GothamBold
    tituloLabel.TextSize = 15
    tituloLabel.TextXAlignment = Enum.TextXAlignment.Left
    tituloLabel.Parent = notifFrame

    local mensajeLabel = Instance.new("TextLabel")
    mensajeLabel.Size = UDim2.new(1, -20, 0, 35)
    mensajeLabel.Position = UDim2.new(0, 12, 0, 28)
    mensajeLabel.BackgroundTransparency = 1
    mensajeLabel.Text = mensaje
    mensajeLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
    mensajeLabel.Font = Enum.Font.Gotham
    mensajeLabel.TextSize = 12
    mensajeLabel.TextXAlignment = Enum.TextXAlignment.Left
    mensajeLabel.TextWrapped = true
    mensajeLabel.Parent = notifFrame

    TweenService:Create(notifFrame, TweenInfo.new(0.4, Enum.EasingStyle.Back), {BackgroundTransparency = 0.2}):Play()

    local sonido = Instance.new("Sound")
    sonido.SoundId = tipo == "exito" and "rbxassetid://9113083740" or tipo == "error" and "rbxassetid://9113084002" or "rbxassetid://9113083740"
    sonido.Volume = 0.3
    sonido.Parent = SoundService
    sonido:Play()
    game:GetService("Debris"):AddItem(sonido, 2)

    task.delay(4, function()
        local tween = TweenService:Create(notifFrame, TweenInfo.new(0.3), {Position = UDim2.new(1, 50, 0, 0), BackgroundTransparency = 1})
        tween:Play()
        tween.Completed:Wait()
        notifFrame:Destroy()
    end)
end

-- ============================================
-- SISTEMA DE SONIDOS
-- ============================================
local function reproducirSonido(id, volumen)
    local s = Instance.new("Sound")
    s.SoundId = "rbxassetid://" .. tostring(id)
    s.Volume = volumen or 0.5
    s.Parent = SoundService
    s:Play()
    game:GetService("Debris"):AddItem(s, 3)
end

-- ============================================
-- PANTALLA DE CARGA
-- ============================================
local loadingGui = Instance.new("ScreenGui")
loadingGui.Name = "GZSSF_Loading"
local successLoad = pcall(function() loadingGui.Parent = coreGui end)
if not successLoad then loadingGui.Parent = localPlayer:WaitForChild("PlayerGui") end

local loadingFrame = Instance.new("Frame")
loadingFrame.Size = UDim2.new(1, 0, 1, 0)
loadingFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
loadingFrame.BackgroundTransparency = 0.1
loadingFrame.BorderSizePixel = 0
loadingFrame.Parent = loadingGui

local loadingText = Instance.new("TextLabel")
loadingText.Size = UDim2.new(0, 400, 0, 60)
loadingText.Position = UDim2.new(0.5, -200, 0.5, -30)
loadingText.BackgroundTransparency = 1
loadingText.Text = "Loading AutoFarm..."
loadingText.TextColor3 = Color3.fromRGB(200, 200, 200)
loadingText.Font = Enum.Font.GothamBold
loadingText.TextSize = 32
loadingText.Parent = loadingFrame

local subText = Instance.new("TextLabel")
subText.Size = UDim2.new(0, 400, 0, 30)
subText.Position = UDim2.new(0.5, -200, 0.5, 30)
subText.BackgroundTransparency = 1
subText.Text = "Please wait"
subText.TextColor3 = Color3.fromRGB(120, 120, 120)
subText.Font = Enum.Font.Gotham
subText.TextSize = 16
subText.Parent = loadingFrame

-- Animacion de puntos
local dots = 0
task.spawn(function()
    while loadingGui and loadingGui.Parent do
        dots = (dots + 1) % 4
        local dotStr = string.rep(".", dots)
        loadingText.Text = "Loading AutoFarm" .. dotStr
        task.wait(0.5)
    end
end)

-- ============================================
-- [1] LISTA DE LAS 11 POSICIONES EXACTAS (SIN TOCAR)
-- ============================================
local posiciones = {
    CFrame.new(44.924678802490234, 68.06687927246094, -858.3729248046875),
    CFrame.new(51.228660583496094, 60.556495666503906, -1310.5465087890625),
    CFrame.new(65.39879608154297, 59.0063591003418, -1700.48291015625),
    CFrame.new(31.886220932006836, 58.59709930419922, -2100.6669921875),
    CFrame.new(50.7166748046875, 59.244754791259766, -2507.328125),
    CFrame.new(29.925827026367188, 59.990867614746094, -2904.8037109375),
    CFrame.new(21.2834415435791, 61.2484245300293, -3305.389892578125),
    CFrame.new(53.96512985229492, 21.130041122436523, -3624.62548828125),
    CFrame.new(53.70255661010742, -848.1310424804688, -3652.822509765625),
    CFrame.new(55.575069427490234, -913.5247192382812, -3907.96240234375),
    CFrame.new(53.860145568847656, -913.52880859375, -3970.546142578125)
}

-- ============================================
-- [2] SISTEMA INDESTRUCTIBLE DE PLATAFORMAS (INVISIBLES)
-- ============================================
local nombreCarpeta = "PlataformasFijas_Xeno"
local carpetaExistente = workspace:FindFirstChild(nombreCarpeta)
if carpetaExistente then carpetaExistente:Destroy() end

local carpeta = Instance.new("Folder")
carpeta.Name = nombreCarpeta
carpeta.Parent = workspace

local plataformas = {}

for i, pos in ipairs(posiciones) do
    local p = Instance.new("Part")
    p.Name = "Plat_" .. i
    p.Shape = Enum.PartType.Block
    p.Size = Vector3.new(20, 2, 20)
    p.Transparency = 1  -- INVISIBLE
    p.CanCollide = true
    p.Anchored = true
    p.Parent = carpeta
    table.insert(plataformas, p)
end

runService.RenderStepped:Connect(function()
    for i, plat in ipairs(plataformas) do
        if plat and plat.Parent then
            plat.CFrame = posiciones[i]
            plat.Anchored = true
            plat.CanCollide = true
            plat.Transparency = 1  -- Mantener invisible
        end
    end
end)

-- ============================================
-- [3] CREACION DEL MENU GUI MEJORADO (COLORES: NEGRO, GRIS, SEMI-TRANSPARENTE)
-- ============================================
local nombreGui = "GZSSF_MenuAutoFarm"
local guiExistente = coreGui:FindFirstChild(nombreGui) or localPlayer.PlayerGui:FindFirstChild(nombreGui)
if guiExistente then guiExistente:Destroy() end

local screenGui = Instance.new("ScreenGui")
screenGui.Name = nombreGui
local success = pcall(function() screenGui.Parent = coreGui end)
if not success then screenGui.Parent = localPlayer:WaitForChild("PlayerGui") end

-- Frame principal
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 280, 0, 460)
frame.Position = UDim2.new(0.5, -140, 0.5, -230)
frame.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
frame.BackgroundTransparency = 0.15
frame.BorderSizePixel = 0
frame.Active = true
frame.Draggable = true
frame.Visible = false  -- Oculto hasta que termine carga
frame.Parent = screenGui

local cornerFrame = Instance.new("UICorner")
cornerFrame.CornerRadius = UDim.new(0, 10)
cornerFrame.Parent = frame

local strokeFrame = Instance.new("UIStroke")
strokeFrame.Color = Color3.fromRGB(60, 60, 60)
strokeFrame.Thickness = 1
strokeFrame.Transparency = 0.5
strokeFrame.Parent = frame

-- Barra superior
local topBar = Instance.new("Frame")
topBar.Size = UDim2.new(1, 0, 0, 40)
topBar.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
topBar.BackgroundTransparency = 0.2
 topBar.BorderSizePixel = 0
topBar.Parent = frame

local cornerTop = Instance.new("UICorner")
cornerTop.CornerRadius = UDim.new(0, 10)
cornerTop.Parent = topBar

local fixCorner = Instance.new("Frame")
fixCorner.Size = UDim2.new(1, 0, 0, 15)
fixCorner.Position = UDim2.new(0, 0, 1, -15)
fixCorner.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
fixCorner.BackgroundTransparency = 0.2
fixCorner.BorderSizePixel = 0
fixCorner.Parent = topBar
--https://www.rblxscripts.net/users/badkarma
-- Titulo principal
local tituloMenu = Instance.new("TextLabel")
tituloMenu.Size = UDim2.new(1, -90, 0, 20)
tituloMenu.Position = UDim2.new(0, 10, 0, 2)
tituloMenu.BackgroundTransparency = 1
tituloMenu.Text = "Script by ThiAez"
tituloMenu.TextColor3 = Color3.fromRGB(220, 220, 220)
tituloMenu.Font = Enum.Font.GothamBold
tituloMenu.TextSize = 16
tituloMenu.TextXAlignment = Enum.TextXAlignment.Left
tituloMenu.Parent = topBar

-- Subtitulo del juego
local subtituloMenu = Instance.new("TextLabel")
subtituloMenu.Size = UDim2.new(1, -90, 0, 16)
subtituloMenu.Position = UDim2.new(0, 10, 0, 22)
subtituloMenu.BackgroundTransparency = 1
subtituloMenu.Text = "Game: Building Boats"
subtituloMenu.TextColor3 = Color3.fromRGB(120, 120, 120)
subtituloMenu.Font = Enum.Font.Gotham
subtituloMenu.TextSize = 11
subtituloMenu.TextXAlignment = Enum.TextXAlignment.Left
subtituloMenu.Parent = topBar

-- Boton Creditos
local botonCreditos = Instance.new("TextButton")
botonCreditos.Size = UDim2.new(0, 65, 0, 24)
botonCreditos.Position = UDim2.new(1, -70, 0.5, -12)
botonCreditos.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
botonCreditos.BackgroundTransparency = 0.3
botonCreditos.Text = "Credits"
botonCreditos.TextColor3 = Color3.fromRGB(180, 180, 180)
botonCreditos.Font = Enum.Font.GothamBold
botonCreditos.TextSize = 11
botonCreditos.Parent = topBar

local cornerCred = Instance.new("UICorner")
cornerCred.CornerRadius = UDim.new(0, 6)
cornerCred.Parent = botonCreditos

-- Contenedor de botones
local scrollFrame = Instance.new("ScrollingFrame")
scrollFrame.Size = UDim2.new(1, -16, 1, -55)
scrollFrame.Position = UDim2.new(0, 8, 0, 48)
scrollFrame.BackgroundTransparency = 1
scrollFrame.BorderSizePixel = 0
scrollFrame.ScrollBarThickness = 3
scrollFrame.ScrollBarImageColor3 = Color3.fromRGB(80, 80, 80)
scrollFrame.CanvasSize = UDim2.new(0, 0, 0, 420)
scrollFrame.Parent = frame

local layout = Instance.new("UIListLayout")
layout.Padding = UDim.new(0, 12)
layout.HorizontalAlignment = Enum.HorizontalAlignment.Center
layout.Parent = scrollFrame

-- ============================================
-- FUNCION AUXILIAR PARA CREAR BOTONES CON DESCRIPCION
-- ============================================
local function crearBotonConDescripcion(nombreBoton, descripcion, parent)
    local contenedor = Instance.new("Frame")
    contenedor.Size = UDim2.new(0.95, 0, 0, 75)
    contenedor.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
    contenedor.BackgroundTransparency = 0.3
    contenedor.BorderSizePixel = 0
    contenedor.Parent = parent

    local cornerCont = Instance.new("UICorner")
    cornerCont.CornerRadius = UDim.new(0, 8)
    cornerCont.Parent = contenedor

    local strokeCont = Instance.new("UIStroke")
    strokeCont.Color = Color3.fromRGB(50, 50, 50)
    strokeCont.Thickness = 1
    strokeCont.Transparency = 0.6
    strokeCont.Parent = contenedor

    local boton = Instance.new("TextButton")
    boton.Size = UDim2.new(1, -16, 0, 36)
    boton.Position = UDim2.new(0, 8, 0, 6)
    boton.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
    boton.BackgroundTransparency = 0.2
    boton.Text = nombreBoton
    boton.TextColor3 = Color3.fromRGB(255, 80, 80)
    boton.Font = Enum.Font.GothamBold
    boton.TextSize = 14
    boton.Parent = contenedor

    local cornerBtn = Instance.new("UICorner")
    cornerBtn.CornerRadius = UDim.new(0, 6)
    cornerBtn.Parent = boton

    local strokeBtn = Instance.new("UIStroke")
    strokeBtn.Color = Color3.fromRGB(80, 80, 80)
    strokeBtn.Thickness = 1
    strokeBtn.Transparency = 0.5
    strokeBtn.Parent = boton

    local descLabel = Instance.new("TextLabel")
    descLabel.Size = UDim2.new(1, -16, 0, 24)
    descLabel.Position = UDim2.new(0, 8, 0, 44)
    descLabel.BackgroundTransparency = 1
    descLabel.Text = descripcion
    descLabel.TextColor3 = Color3.fromRGB(100, 100, 100)
    descLabel.Font = Enum.Font.Gotham
    descLabel.TextSize = 10
    descLabel.TextWrapped = true
    descLabel.TextXAlignment = Enum.TextXAlignment.Left
    descLabel.Parent = contenedor

    return boton, contenedor, strokeBtn
end

-- ============================================
-- BOTON AUTOFARM (SIN DESCRIPCION - COMO PEDISTE)
-- ============================================
local autoFarmActivo = false

local contenedorFarm = Instance.new("Frame")
contenedorFarm.Size = UDim2.new(0.95, 0, 0, 50)
contenedorFarm.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
contenedorFarm.BackgroundTransparency = 0.3
contenedorFarm.BorderSizePixel = 0
contenedorFarm.Parent = scrollFrame

local cornerFarmCont = Instance.new("UICorner")
cornerFarmCont.CornerRadius = UDim.new(0, 8)
cornerFarmCont.Parent = contenedorFarm

local strokeFarmCont = Instance.new("UIStroke")
strokeFarmCont.Color = Color3.fromRGB(50, 50, 50)
strokeFarmCont.Thickness = 1
strokeFarmCont.Transparency = 0.6
strokeFarmCont.Parent = contenedorFarm

local botonFarm = Instance.new("TextButton")
botonFarm.Size = UDim2.new(1, -16, 0, 36)
botonFarm.Position = UDim2.new(0, 8, 0, 7)
botonFarm.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
botonFarm.BackgroundTransparency = 0.2
botonFarm.Text = "AutoFarm: OFF"
botonFarm.TextColor3 = Color3.fromRGB(255, 80, 80)
botonFarm.Font = Enum.Font.GothamBold
botonFarm.TextSize = 14
botonFarm.Parent = contenedorFarm

local cornerFarm = Instance.new("UICorner")
cornerFarm.CornerRadius = UDim.new(0, 6)
cornerFarm.Parent = botonFarm

local strokeFarm = Instance.new("UIStroke")
strokeFarm.Color = Color3.fromRGB(80, 80, 80)
strokeFarm.Thickness = 1
strokeFarm.Transparency = 0.5
strokeFarm.Parent = botonFarm

botonFarm.MouseButton1Click:Connect(function()
    autoFarmActivo = not autoFarmActivo

    if autoFarmActivo then
        botonFarm.Text = "AutoFarm: ON"
        botonFarm.TextColor3 = Color3.fromRGB(100, 255, 100)
        strokeFarm.Color = Color3.fromRGB(100, 255, 100)
        reproducirSonido(9113083740, 0.4)
        crearNotificacion("AutoFarm", "AutoFarm enabled successfully", "exito")
    else
        botonFarm.Text = "AutoFarm: OFF"
        botonFarm.TextColor3 = Color3.fromRGB(255, 80, 80)
        strokeFarm.Color = Color3.fromRGB(80, 80, 80)
        reproducirSonido(9113084002, 0.4)
        crearNotificacion("AutoFarm", "AutoFarm disabled", "advertencia")
    end
end)

-- ============================================
-- BOTON SUPER BOOST FPS
-- ============================================
local superBoostActivo = false
local foldersBackup = {}

local botonSuperBoost, contSuperBoost, strokeSuperBoost = crearBotonConDescripcion(
    "Super Boost FPS: OFF",
    "Removes all folders from Workspace to maximize performance. Restores them when disabled.",
    scrollFrame
)

botonSuperBoost.MouseButton1Click:Connect(function()
    superBoostActivo = not superBoostActivo

    if superBoostActivo then
        foldersBackup = {}
        for _, obj in ipairs(workspace:GetChildren()) do
            if obj:IsA("Folder") and obj.Name ~= nombreCarpeta then
                table.insert(foldersBackup, obj:Clone())
                obj:Destroy()
            end
        end

        botonSuperBoost.Text = "Super Boost FPS: ON"
        botonSuperBoost.TextColor3 = Color3.fromRGB(100, 255, 100)
        strokeSuperBoost.Color = Color3.fromRGB(100, 255, 100)
        reproducirSonido(9113083740, 0.4)
        crearNotificacion("Super Boost FPS", "All folders removed for maximum performance", "exito")
    else
        for _, folderClone in ipairs(foldersBackup) do
            if folderClone then
                folderClone.Parent = workspace
            end
        end
        foldersBackup = {}

        botonSuperBoost.Text = "Super Boost FPS: OFF"
        botonSuperBoost.TextColor3 = Color3.fromRGB(255, 80, 80)
        strokeSuperBoost.Color = Color3.fromRGB(80, 80, 80)
        reproducirSonido(9113084002, 0.4)
        crearNotificacion("Super Boost FPS", "Folders restored", "advertencia")
    end
end)

-- ============================================
-- BOTON BOOST FPS
-- ============================================
local boostActivo = false
local texturasBackup = {}
local graficosOriginales = {}

local botonBoost, contBoost, strokeBoost = crearBotonConDescripcion(
    "Boost FPS: OFF",
    "Removes textures/decals and lowers graphics quality. Restores settings when disabled.",
    scrollFrame
)

botonBoost.MouseButton1Click:Connect(function()
    boostActivo = not boostActivo

    if boostActivo then
        texturasBackup = {}
        for _, obj in ipairs(workspace:GetDescendants()) do
            if obj:IsA("BasePart") then
                table.insert(texturasBackup, {obj = obj, material = obj.Material})
                obj.Material = Enum.Material.SmoothPlastic
            elseif obj:IsA("Decal") or obj:IsA("Texture") then
                table.insert(texturasBackup, {obj = obj, parent = obj.Parent})
                obj:Destroy()
            end
        end

        graficosOriginales = {
            quality = settings().Rendering.QualityLevel,
            shadows = lighting.GlobalShadows
        }
        settings().Rendering.QualityLevel = Enum.QualityLevel.Level01
        lighting.GlobalShadows = false

        botonBoost.Text = "Boost FPS: ON"
        botonBoost.TextColor3 = Color3.fromRGB(100, 255, 100)
        strokeBoost.Color = Color3.fromRGB(100, 255, 100)
        reproducirSonido(9113083740, 0.4)
        crearNotificacion("Boost FPS", "Textures removed and graphics lowered", "exito")
    else
        for _, data in ipairs(texturasBackup) do
            if data.obj and data.obj.Parent then
                if data.material then
                    data.obj.Material = data.material
                end
            end
        end
        texturasBackup = {}

        if graficosOriginales.quality then
            settings().Rendering.QualityLevel = graficosOriginales.quality
        end
        lighting.GlobalShadows = graficosOriginales.shadows

        botonBoost.Text = "Boost FPS: OFF"
        botonBoost.TextColor3 = Color3.fromRGB(255, 80, 80)
        strokeBoost.Color = Color3.fromRGB(80, 80, 80)
        reproducirSonido(9113084002, 0.4)
        crearNotificacion("Boost FPS", "Graphics restored", "advertencia")
    end
end)

-- ============================================
-- BOTON ANTIBAN (NUEVO)
-- ============================================
local antiBanActivo = true

local botonAntiBan, contAntiBan, strokeAntiBan = crearBotonConDescripcion(
    "AntiBan: ON",
    "Prevents kicks, hides your name from reports, and spoofs display name for protection.",
    scrollFrame
)

botonAntiBan.TextColor3 = Color3.fromRGB(100, 255, 100)
strokeAntiBan.Color = Color3.fromRGB(100, 255, 100)

botonAntiBan.MouseButton1Click:Connect(function()
    antiBanActivo = not antiBanActivo

    if antiBanActivo then
        botonAntiBan.Text = "AntiBan: ON"
        botonAntiBan.TextColor3 = Color3.fromRGB(100, 255, 100)
        strokeAntiBan.Color = Color3.fromRGB(100, 255, 100)
        reproducirSonido(9113083740, 0.4)
        crearNotificacion("AntiBan", "AntiBan protection enabled", "exito")
    else
        botonAntiBan.Text = "AntiBan: OFF"
        botonAntiBan.TextColor3 = Color3.fromRGB(255, 80, 80)
        strokeAntiBan.Color = Color3.fromRGB(80, 80, 80)
        reproducirSonido(9113084002, 0.4)
        crearNotificacion("AntiBan", "AntiBan protection disabled", "advertencia")
    end
end)

-- ============================================
-- BOTON ANTIAFK (NUEVO)
-- ============================================
local antiAFKActivo = true

local botonAntiAFK, contAntiAFK, strokeAntiAFK = crearBotonConDescripcion(
    "AntiAFK: ON",
    "Prevents automatic kick for being AFK by simulating player activity every few minutes.",
    scrollFrame
)

botonAntiAFK.TextColor3 = Color3.fromRGB(100, 255, 100)
strokeAntiAFK.Color = Color3.fromRGB(100, 255, 100)

botonAntiAFK.MouseButton1Click:Connect(function()
    antiAFKActivo = not antiAFKActivo

    if antiAFKActivo then
        if not antiAFKConnection or not antiAFKConnection.Connected then
            iniciarAntiAFK()
        end
        botonAntiAFK.Text = "AntiAFK: ON"
        botonAntiAFK.TextColor3 = Color3.fromRGB(100, 255, 100)
        strokeAntiAFK.Color = Color3.fromRGB(100, 255, 100)
        reproducirSonido(9113083740, 0.4)
        crearNotificacion("AntiAFK", "AntiAFK enabled - You wont be kicked for inactivity", "exito")
    else
        if antiAFKConnection then
            antiAFKConnection:Disconnect()
        end
        botonAntiAFK.Text = "AntiAFK: OFF"
        botonAntiAFK.TextColor3 = Color3.fromRGB(255, 80, 80)
        strokeAntiAFK.Color = Color3.fromRGB(80, 80, 80)
        reproducirSonido(9113084002, 0.4)
        crearNotificacion("AntiAFK", "AntiAFK disabled", "advertencia")
    end
end)

-- ============================================
-- PANEL DE CREDITOS
-- ============================================
local creditosFrame = Instance.new("Frame")
creditosFrame.Size = UDim2.new(0, 300, 0, 400)
creditosFrame.Position = UDim2.new(0.5, -150, 0.5, -200)
creditosFrame.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
creditosFrame.BackgroundTransparency = 0.15
creditosFrame.BorderSizePixel = 0
creditosFrame.Visible = false
creditosFrame.ZIndex = 100
creditosFrame.Parent = screenGui

local cornerCredFrame = Instance.new("UICorner")
cornerCredFrame.CornerRadius = UDim.new(0, 12)
cornerCredFrame.Parent = creditosFrame

local strokeCredFrame = Instance.new("UIStroke")
strokeCredFrame.Color = Color3.fromRGB(60, 60, 60)
strokeCredFrame.Thickness = 1
strokeCredFrame.Transparency = 0.5
strokeCredFrame.Parent = creditosFrame

-- Barra superior creditos
local topBarCred = Instance.new("Frame")
topBarCred.Size = UDim2.new(1, 0, 0, 35)
topBarCred.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
topBarCred.BackgroundTransparency = 0.2
topBarCred.BorderSizePixel = 0
topBarCred.ZIndex = 101
topBarCred.Parent = creditosFrame

local cornerTopCred = Instance.new("UICorner")
cornerTopCred.CornerRadius = UDim.new(0, 12)
cornerTopCred.Parent = topBarCred

local fixCornerCred = Instance.new("Frame")
fixCornerCred.Size = UDim2.new(1, 0, 0, 15)
fixCornerCred.Position = UDim2.new(0, 0, 1, -15)
fixCornerCred.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
fixCornerCred.BackgroundTransparency = 0.2
fixCornerCred.BorderSizePixel = 0
fixCornerCred.ZIndex = 101
fixCornerCred.Parent = topBarCred

local tituloCred = Instance.new("TextLabel")
tituloCred.Size = UDim2.new(1, -40, 1, 0)
tituloCred.Position = UDim2.new(0, 10, 0, 0)
tituloCred.BackgroundTransparency = 1
tituloCred.Text = "Credits"
tituloCred.TextColor3 = Color3.fromRGB(200, 200, 200)
tituloCred.Font = Enum.Font.GothamBold
tituloCred.TextSize = 16
 tituloCred.ZIndex = 102
tituloCred.Parent = topBarCred

-- Boton cerrar creditos
local botonCerrarCred = Instance.new("TextButton")
botonCerrarCred.Size = UDim2.new(0, 26, 0, 26)
botonCerrarCred.Position = UDim2.new(1, -31, 0.5, -13)
botonCerrarCred.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
botonCerrarCred.BackgroundTransparency = 0.3
botonCerrarCred.Text = "X"
botonCerrarCred.TextColor3 = Color3.fromRGB(200, 200, 200)
botonCerrarCred.Font = Enum.Font.GothamBold
botonCerrarCred.TextSize = 13
botonCerrarCred.ZIndex = 102
botonCerrarCred.Parent = topBarCred

local cornerCerrar = Instance.new("UICorner")
cornerCerrar.CornerRadius = UDim.new(0, 6)
cornerCerrar.Parent = botonCerrarCred

botonCerrarCred.MouseButton1Click:Connect(function()
    creditosFrame.Visible = false
    reproducirSonido(9113084002, 0.3)
end)

-- Contenido creditos
local contenidoCred = Instance.new("Frame")
contenidoCred.Size = UDim2.new(1, -20, 1, -50)
contenidoCred.Position = UDim2.new(0, 10, 0, 45)
contenidoCred.BackgroundTransparency = 1
contenidoCred.ZIndex = 101
contenidoCred.Parent = creditosFrame

local layoutCred = Instance.new("UIListLayout")
layoutCred.Padding = UDim.new(0, 12)
layoutCred.HorizontalAlignment = Enum.HorizontalAlignment.Center
layoutCred.Parent = contenidoCred

-- Foto de perfil
local avatarFrame = Instance.new("Frame")
avatarFrame.Size = UDim2.new(0, 90, 0, 90)
avatarFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
avatarFrame.BackgroundTransparency = 0.3
avatarFrame.ZIndex = 101
avatarFrame.Parent = contenidoCred

local cornerAvatar = Instance.new("UICorner")
cornerAvatar.CornerRadius = UDim.new(1, 0)
cornerAvatar.Parent = avatarFrame

local avatarImage = Instance.new("ImageLabel")
avatarImage.Size = UDim2.new(1, -6, 1, -6)
avatarImage.Position = UDim2.new(0, 3, 0, 3)
avatarImage.BackgroundTransparency = 1
avatarImage.Image = "https://www.roblox.com/headshot-thumbnail/image?userId=9122306648&width=420&height=420&format=png"
avatarImage.ZIndex = 102
avatarImage.Parent = avatarFrame

local cornerAvatarImg = Instance.new("UICorner")
cornerAvatarImg.CornerRadius = UDim.new(1, 0)
cornerAvatarImg.Parent = avatarImage

-- Nombre
local nombreLabel = Instance.new("TextLabel")
nombreLabel.Size = UDim2.new(1, 0, 0, 25)
nombreLabel.BackgroundTransparency = 1
nombreLabel.Text = "ThiAez"
nombreLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
nombreLabel.Font = Enum.Font.GothamBold
nombreLabel.TextSize = 20
nombreLabel.ZIndex = 101
nombreLabel.Parent = contenidoCred

-- Seccion Roblox
local robloxFrame = Instance.new("Frame")
robloxFrame.Size = UDim2.new(1, 0, 0, 80)
robloxFrame.BackgroundColor3 = Color3.fromRGB(18, 18, 18)
robloxFrame.BackgroundTransparency = 0.3
robloxFrame.ZIndex = 101
robloxFrame.Parent = contenidoCred

local cornerRoblox = Instance.new("UICorner")
cornerRoblox.CornerRadius = UDim.new(0, 8)
cornerRoblox.Parent = robloxFrame

local sigueRoblox = Instance.new("TextLabel")
sigueRoblox.Size = UDim2.new(1, -10, 0, 20)
sigueRoblox.Position = UDim2.new(0, 5, 0, 5)
sigueRoblox.BackgroundTransparency = 1
sigueRoblox.Text = "Follow me on Roblox"
sigueRoblox.TextColor3 = Color3.fromRGB(150, 150, 150)
sigueRoblox.Font = Enum.Font.Gotham
sigueRoblox.TextSize = 13
sigueRoblox.ZIndex = 102
sigueRoblox.Parent = robloxFrame

local botonCopiarRoblox = Instance.new("TextButton")
botonCopiarRoblox.Size = UDim2.new(0.9, 0, 0, 32)
botonCopiarRoblox.Position = UDim2.new(0.05, 0, 0, 35)
botonCopiarRoblox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
botonCopiarRoblox.BackgroundTransparency = 0.3
botonCopiarRoblox.Text = "Copy Link"
botonCopiarRoblox.TextColor3 = Color3.fromRGB(180, 180, 180)
botonCopiarRoblox.Font = Enum.Font.GothamBold
botonCopiarRoblox.TextSize = 13
botonCopiarRoblox.ZIndex = 102
botonCopiarRoblox.Parent = robloxFrame

local cornerCopiarR = Instance.new("UICorner")
cornerCopiarR.CornerRadius = UDim.new(0, 6)
cornerCopiarR.Parent = botonCopiarRoblox

botonCopiarRoblox.MouseButton1Click:Connect(function()
    local link = "https://www.roblox.com/es/users/9122306648/profile"
    if setclipboard then
        setclipboard(link)
        crearNotificacion("Copied", "Roblox profile link copied to clipboard", "exito")
        reproducirSonido(9113083740, 0.3)
    else
        crearNotificacion("Error", "Could not copy to clipboard", "error")
    end
end)

-- Seccion Rscript
local rscriptFrame = Instance.new("Frame")
rscriptFrame.Size = UDim2.new(1, 0, 0, 80)
rscriptFrame.BackgroundColor3 = Color3.fromRGB(18, 18, 18)
rscriptFrame.BackgroundTransparency = 0.3
rscriptFrame.ZIndex = 101
rscriptFrame.Parent = contenidoCred

local cornerRscript = Instance.new("UICorner")
cornerRscript.CornerRadius = UDim.new(0, 8)
cornerRscript.Parent = rscriptFrame

local sigueRscript = Instance.new("TextLabel")
sigueRscript.Size = UDim2.new(1, -10, 0, 20)
sigueRscript.Position = UDim2.new(0, 5, 0, 5)
sigueRscript.BackgroundTransparency = 1
sigueRscript.Text = "Follow me on Rscript"
sigueRscript.TextColor3 = Color3.fromRGB(150, 150, 150)
sigueRscript.Font = Enum.Font.Gotham
sigueRscript.TextSize = 13
sigueRscript.ZIndex = 102
sigueRscript.Parent = rscriptFrame

local botonCopiarRscript = Instance.new("TextButton")
botonCopiarRscript.Size = UDim2.new(0.9, 0, 0, 32)
botonCopiarRscript.Position = UDim2.new(0.05, 0, 0, 35)
botonCopiarRscript.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
botonCopiarRscript.BackgroundTransparency = 0.3
botonCopiarRscript.Text = "Copy Link"
botonCopiarRscript.TextColor3 = Color3.fromRGB(180, 180, 180)
botonCopiarRscript.Font = Enum.Font.GothamBold
botonCopiarRscript.TextSize = 13
botonCopiarRscript.ZIndex = 102
botonCopiarRscript.Parent = rscriptFrame

local cornerCopiarRs = Instance.new("UICorner")
cornerCopiarRs.CornerRadius = UDim.new(0, 6)
cornerCopiarRs.Parent = botonCopiarRscript

botonCopiarRscript.MouseButton1Click:Connect(function()
    local link = "https://rscripts.net/@ThiAez"
    if setclipboard then
        setclipboard(link)
        crearNotificacion("Copied", "Rscript profile link copied to clipboard", "exito")
        reproducirSonido(9113083740, 0.3)
    else
        crearNotificacion("Error", "Could not copy to clipboard", "error")
    end
end)

-- Mensaje final
local mensajeFinal = Instance.new("TextLabel")
mensajeFinal.Size = UDim2.new(1, 0, 0, 25)
mensajeFinal.BackgroundTransparency = 1
mensajeFinal.Text = "Thanks for using my script!"
mensajeFinal.TextColor3 = Color3.fromRGB(120, 120, 120)
mensajeFinal.Font = Enum.Font.GothamBold
mensajeFinal.TextSize = 12
mensajeFinal.ZIndex = 101
mensajeFinal.Parent = contenidoCred

-- Abrir creditos
botonCreditos.MouseButton1Click:Connect(function()
    creditosFrame.Visible = true
    reproducirSonido(9113083740, 0.3)
    crearNotificacion("Credits", "Credits panel opened", "info")
end)

-- ============================================
-- [4] LOGICA DEL BUCLE AUTOFARM (SIN TOCAR)
-- ============================================
task.spawn(function()
    while task.wait() do
        if autoFarmActivo then
            for i = 1, #posiciones do
                if not autoFarmActivo then break end

                local character = localPlayer.Character
                if character and character:FindFirstChild("HumanoidRootPart") then
                    character.HumanoidRootPart.CFrame = posiciones[i] * CFrame.new(0, 3, 0)
                end

                if i == 11 then
                    task.wait(6)
                else
                    task.wait(4)
                end
            end
        end
    end
end)

-- ============================================
-- CARGA FINAL - MOSTRAR MENU
-- ============================================
task.delay(2.5, function()
    if loadingGui then
        local tween = TweenService:Create(loadingFrame, TweenInfo.new(0.5), {BackgroundTransparency = 1})
        tween:Play()
        tween.Completed:Wait()
        loadingGui:Destroy()
    end

    frame.Visible = true
    TweenService:Create(frame, TweenInfo.new(0.4, Enum.EasingStyle.Back), {Size = UDim2.new(0, 280, 0, 460)}):Play()

    reproducirSonido(9113083740, 0.5)
    crearNotificacion("GZSSF", "Script loaded successfully - By ThiAez", "exito")
    crearNotificacion("AntiAFK", "AntiAFK is active - You wont be kicked", "info")
    crearNotificacion("AntiBan", "AntiBan protection is active", "info")
end)
Compatible executors: HydrogenMacSploitAWP.GGDelta

Script #2 Aurora Hub

Script #2 · Aurora HubFree
Auto FarmTeleportFly
loadstring(game:HttpGet("https://rawscripts.net/raw/Universal-Script-Aurora-Hub-Keyless-Script-Hub-246096"))()
Compatible executors: HydrogenMacSploitAWP.GGDelta

Script #3 Auto Farm & More

Script #3 · Auto Farm & MoreFree
Auto FarmFlyAuto Collect
-- // Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local Workspace = game:GetService("Workspace")

local LocalPlayer = Players.LocalPlayer

-- // Safe GUI Container
local function getRootGuiContainer()
    if gethui then
        return gethui()
    end
    local success, result = pcall(function()
        return game:GetService("CoreGui")
    end)
    if success and result then
        return result
    end
    return LocalPlayer:FindFirstChildOfClass("PlayerGui") or LocalPlayer:WaitForChild("PlayerGui")
end

-- // Prevent Double Execution
local targetParent = getRootGuiContainer()
if targetParent:FindFirstChild("BoatAutoFarmGUI") then
    targetParent.BoatAutoFarmGUI:Destroy()
end

-- // GUI Creation
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "BoatAutoFarmGUI"
ScreenGui.Parent = targetParent
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling

-- Main Frame (380 x 280)
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Parent = ScreenGui
MainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 35)
MainFrame.Position = UDim2.new(0.5, -190, 0.5, -140)
MainFrame.Size = UDim2.new(0, 380, 0, 280)
MainFrame.Active = true
MainFrame.Draggable = true
MainFrame.ClipsDescendants = true

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

-- Title Bar
local TitleBar = Instance.new("Frame")
TitleBar.Name = "TitleBar"
TitleBar.Parent = MainFrame
TitleBar.BackgroundColor3 = Color3.fromRGB(35, 35, 45)
TitleBar.BorderSizePixel = 0
TitleBar.Size = UDim2.new(1, 0, 0, 45)

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

local TitleFix = Instance.new("Frame")
TitleFix.Parent = TitleBar
TitleFix.BackgroundColor3 = Color3.fromRGB(35, 35, 45)
TitleFix.BorderSizePixel = 0
TitleFix.Position = UDim2.new(0, 0, 0.5, 0)
TitleFix.Size = UDim2.new(1, 0, 0.5, 0)

local TitleText = Instance.new("TextLabel")
TitleText.Parent = TitleBar
TitleText.BackgroundTransparency = 1
TitleText.Position = UDim2.new(0, 15, 0, 0)
TitleText.Size = UDim2.new(1, -90, 1, 0)
TitleText.Font = Enum.Font.GothamBold
TitleText.Text = "Build a Boat Auto-Farm"
TitleText.TextColor3 = Color3.fromRGB(255, 255, 255)
TitleText.TextSize = 15
TitleText.TextXAlignment = Enum.TextXAlignment.Left

-- // Tab Navigation System
local TabContainer = Instance.new("Frame")
TabContainer.Parent = MainFrame
TabContainer.BackgroundTransparency = 1
TabContainer.Position = UDim2.new(0, 15, 0, 55)
TabContainer.Size = UDim2.new(1, -30, 0, 30)

local TabListLayout = Instance.new("UIListLayout")
TabListLayout.Parent = TabContainer
TabListLayout.FillDirection = Enum.FillDirection.Horizontal
TabListLayout.SortOrder = Enum.SortOrder.LayoutOrder
TabListLayout.Padding = UDim.new(0, 10)

-- Content Pages Container
local PagesContainer = Instance.new("Frame")
PagesContainer.Parent = MainFrame
PagesContainer.BackgroundTransparency = 1
PagesContainer.Position = UDim2.new(0, 15, 0, 95)
PagesContainer.Size = UDim2.new(1, -30, 1, -105)
PagesContainer.ClipsDescendants = true

local MainTabPage = Instance.new("ScrollingFrame")
MainTabPage.Name = "MainTabPage"
MainTabPage.Parent = PagesContainer
MainTabPage.BackgroundTransparency = 1
MainTabPage.Size = UDim2.new(1, 0, 1, 0)
MainTabPage.CanvasSize = UDim2.new(0, 0, 0, 180)
MainTabPage.ScrollBarThickness = 4
MainTabPage.Visible = true

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

local SettingsTabPage = Instance.new("ScrollingFrame")
SettingsTabPage.Name = "SettingsTabPage"
SettingsTabPage.Parent = PagesContainer
SettingsTabPage.BackgroundTransparency = 1
SettingsTabPage.Size = UDim2.new(1, 0, 1, 0)
SettingsTabPage.CanvasSize = UDim2.new(0, 0, 0, 180)
SettingsTabPage.ScrollBarThickness = 4
SettingsTabPage.Visible = false

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

-- Create Tab Buttons
local function CreateTabButton(name, pageToShow)
    local TabBtn = Instance.new("TextButton")
    TabBtn.Parent = TabContainer
    TabBtn.BackgroundColor3 = Color3.fromRGB(40, 40, 50)
    TabBtn.Size = UDim2.new(0, 110, 1, 0)
    TabBtn.Font = Enum.Font.GothamSemibold
    TabBtn.Text = name
    TabBtn.TextColor3 = Color3.fromRGB(180, 180, 180)
    TabBtn.TextSize = 13

    local Corner = Instance.new("UICorner")
    Corner.CornerRadius = UDim.new(0, 6)
    Corner.Parent = TabBtn

    TabBtn.MouseButton1Click:Connect(function()
        MainTabPage.Visible = (pageToShow == MainTabPage)
        SettingsTabPage.Visible = (pageToShow == SettingsTabPage)
    end)
end

CreateTabButton("Main", MainTabPage)
CreateTabButton("Settings", SettingsTabPage)

-- // Helper Function: Create Toggle Button & Return Update Reference
local function CreateToggle(parent, name, callback)
    local ToggleBtn = Instance.new("TextButton")
    ToggleBtn.Parent = parent
    ToggleBtn.BackgroundColor3 = Color3.fromRGB(45, 45, 55)
    ToggleBtn.Size = UDim2.new(1, 0, 0, 40)
    ToggleBtn.Font = Enum.Font.GothamSemibold
    ToggleBtn.Text = "  " .. name .. ": [ OFF ]"
    ToggleBtn.TextColor3 = Color3.fromRGB(200, 200, 200)
    ToggleBtn.TextSize = 13
    ToggleBtn.TextXAlignment = Enum.TextXAlignment.Left

    local BtnCorner = Instance.new("UICorner")
    BtnCorner.CornerRadius = UDim.new(0, 6)
    BtnCorner.Parent = ToggleBtn

    local enabled = false
    
    local function setState(newState)
        enabled = newState
        if enabled then
            ToggleBtn.Text = "  " .. name .. ": [ ON ]"
            ToggleBtn.TextColor3 = Color3.fromRGB(46, 204, 113)
            ToggleBtn.BackgroundColor3 = Color3.fromRGB(35, 55, 45)
        else
            ToggleBtn.Text = "  " .. name .. ": [ OFF ]"
            ToggleBtn.TextColor3 = Color3.fromRGB(200, 200, 200)
            ToggleBtn.BackgroundColor3 = Color3.fromRGB(45, 45, 55)
        end
        callback(enabled)
    end

    ToggleBtn.MouseButton1Click:Connect(function()
        setState(not enabled)
    end)
    
    return setState, function() return enabled end
end

-- // Helper Function: Create Standard Button
local function CreateButton(parent, name, color, callback)
    local Btn = Instance.new("TextButton")
    Btn.Parent = parent
    Btn.BackgroundColor3 = color
    Btn.Size = UDim2.new(1, 0, 0, 40)
    Btn.Font = Enum.Font.GothamSemibold
    Btn.Text = name
    Btn.TextColor3 = Color3.fromRGB(255, 255, 255)
    Btn.TextSize = 13

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

    Btn.MouseButton1Click:Connect(callback)
end

-- // Script Logic & State Variables
local autoFarmActive = false
local autoCollectActive = false
-- Increased Y altitude offset (+120 studs high) so you fly comfortably higher up
local endPosition = Vector3.new(-50, 120, 9490) 

local setAutoFarmState, getAutoFarmState

-- Butter-Smooth RenderStepped Flight (Higher Altitude Adjustment)
RunService.RenderStepped:Connect(function(dt)
    if not autoFarmActive then return end
    
    local char = LocalPlayer.Character
    if not char then return end
    local hrp = char:FindFirstChild("HumanoidRootPart")
    local humanoid = char:FindFirstChildOfClass("Humanoid")
    
    if hrp and humanoid and humanoid.Health > 0 then
        humanoid.PlatformStand = true
        
        for _, part in ipairs(char:GetDescendants()) do
            if part:IsA("BasePart") then
                part.CanCollide = false
            end
        end
        
        local currentPos = hrp.Position
        local distance = (endPosition - currentPos).Magnitude
        
        if distance > 15 then
            local speed = 200 * dt
            local targetDestination = Vector3.new(endPosition.X, endPosition.Y, endPosition.Z)
            local newPos = currentPos:Lerp(targetDestination, math.clamp(speed / distance, 0, 1))
            
            hrp.CFrame = CFrame.new(newPos, targetDestination)
            hrp.Velocity = Vector3.new(0, 0, 0)
            hrp.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
        else
            humanoid.PlatformStand = false
            autoFarmActive = false
            if setAutoFarmState then setAutoFarmState(false) end
        end
    end
end)

-- Auto Respawn Loop Handler
task.spawn(function()
    while true do
        task.wait(1)
        if getAutoFarmState and getAutoFarmState() and not autoFarmActive then
            local char = LocalPlayer.Character
            if char and char:FindFirstChildOfClass("Humanoid") and char.Humanoid.Health <= 0 then
                LocalPlayer.CharacterAdded:Wait()
                task.wait(1.5)
                autoFarmActive = true
            end
        end
    end
end)

setAutoFarmState, getAutoFarmState = CreateToggle(MainTabPage, "Auto Farm (Fly to End)", function(state)
    autoFarmActive = state
    local char = LocalPlayer.Character
    if char and char:FindFirstChild("HumanoidRootPart") then
        if not autoFarmActive then
            local humanoid = char:FindFirstChildOfClass("Humanoid")
            if humanoid then humanoid.PlatformStand = false end
        end
    end
end)

-- Zero-Lag Auto Collect Gold
CreateToggle(MainTabPage, "Auto Collect Gold", function(state)
    autoCollectActive = state
    task.spawn(function()
        while autoCollectActive do
            task.wait(1.5)
            pcall(function()
                local char = LocalPlayer.Character
                local hrp = char and char:FindFirstChild("HumanoidRootPart")
                if hrp then
                    if (endPosition - hrp.Position).Magnitude < 180 then
                        for _, obj in ipairs(Workspace:GetDescendants()) do
                            if obj:IsA("TouchTransmitter") and obj.Parent then
                                local nameLower = obj.Parent.Name:lower()
                                if nameLower:find("chest") or nameLower:find("gold") or nameLower:find("treasure") or nameLower:find("reward") then
                                    firetouchinterest(hrp, obj.Parent, 0)
                                    task.wait(0.05)
                                    firetouchinterest(hrp, obj.Parent, 1)
                                end
                            end
                        end
                    end
                    
                    for _, gui in ipairs(LocalPlayer.PlayerGui:GetDescendants()) do
                        if gui:IsA("TextButton") or gui:IsA("ImageButton") then
                            local textLower = (gui.Name .. (gui:IsA("TextButton") and gui.Text or "")):lower()
                            if textLower:find("collect") or textLower:find("claim") or textLower:find("reward") then
                                if gui.Visible then
                                    for _, connection in ipairs(getconnections(gui.MouseButton1Click)) do
                                        connection:Fire()
                                    end
                                end
                            end
                        end
                    end
                end
            end)
        end
    end)
end)

-- Settings: Unload Button
CreateButton(SettingsTabPage, "Unload Script", Color3.fromRGB(217, 83, 79), function()
    autoFarmActive = false
    autoCollectActive = false
    local char = LocalPlayer.Character
    if char and char:FindFirstChildOfClass("Humanoid") then
        char.Humanoid.PlatformStand = false
    end
    ScreenGui:Destroy()
end)

-- Minimize Button with Smooth Animations
local MinimizeBtn = Instance.new("TextButton")
MinimizeBtn.Parent = TitleBar
MinimizeBtn.BackgroundColor3 = Color3.fromRGB(45, 45, 55)
MinimizeBtn.Position = UDim2.new(1, -40, 0, 7)
MinimizeBtn.Size = UDim2.new(0, 32, 0, 32)
MinimizeBtn.Font = Enum.Font.GothamBold
MinimizeBtn.Text = "-"
MinimizeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
MinimizeBtn.TextSize = 16

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

local minimized = false
MinimizeBtn.MouseButton1Click:Connect(function()
    minimized = not minimized
    
    local targetSize = minimized and UDim2.new(0, 380, 0, 45) or UDim2.new(0, 380, 0, 280)
    local tweenInfo = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
    
    local resizeTween = TweenService:Create(MainFrame, tweenInfo, {Size = targetSize})
    resizeTween:Play()
    
    TabContainer.Visible = not minimized
    if minimized then
        PagesContainer.Visible = false
        MinimizeBtn.Text = "+"
    else
        PagesContainer.Visible = true
        MinimizeBtn.Text = "-"
    end
end)
Compatible executors: HydrogenMacSploitAWP.GGDelta

Script #4 Auto Farm & More

Script #4 · Auto Farm & MoreFree
Auto FarmFlyNoclip
loadstring(game:HttpGet("https://raw.githubusercontent.com/Usernadddddd1/easy-farm-BABFT-roblox-v1.0/refs/heads/main/script%20easy%20farm%20babft.lua"))()
Compatible executors: HydrogenMacSploitAWP.GGDelta

Script #5 Auto Farm & More (Open-Source Update)

Script #5 · Auto Farm & MoreFree
Auto FarmGod Mode
local player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local stages = workspace:WaitForChild("BoatStages"):WaitForChild("NormalStages")
local penguinEvent = workspace:WaitForChild("ChangeCharacter")
local goldEvent = workspace:WaitForChild("ClaimRiverResultsGold")

local MAX_STAGES = 10
local STAGE_DURATION = 0.5   -- u can change with +/- in gui
local GOLD_COLLECT_RADIUS = 40
local GOD_MODE_ENABLED = true
local LOW_GRAVITY = 0

--gold per cycle lol
local GOLD_PER_CYCLE = 100   -- not sure if thats correct

local originalGravity = workspace.Gravity
local farming = false
local russian = false
local rainbowThread = nil
local hintRainbowThread = nil

--Gold/h tests?
local cycleStartTime = 0
local goldPerHour = 0
local totalCycles = 0
local totalGold = 0
local startFarmTime = 0   

-- ==================== ScreenGui ====================
local gui = Instance.new("ScreenGui")
gui.Name = "GoldFarmGUI"
gui.ResetOnSpawn = false
gui.Parent = player:WaitForChild("PlayerGui")

-- ==================== Main screen ====================
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(0, 340, 0, 220)
MainFrame.Position = UDim2.new(0.5, -170, 0.4, 0)
MainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 35)
MainFrame.BorderSizePixel = 0
MainFrame.Active = true
MainFrame.Visible = true
MainFrame.Parent = gui

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

local MainGradient = Instance.new("UIGradient")
MainGradient.Color = ColorSequence.new{
    ColorSequenceKeypoint.new(0, Color3.fromRGB(30, 30, 45)),
    ColorSequenceKeypoint.new(1, Color3.fromRGB(20, 20, 30))
}
MainGradient.Parent = MainFrame

local TitleBar = Instance.new("TextButton")
TitleBar.Size = UDim2.new(1, 0, 0, 30)
TitleBar.Position = UDim2.new(0, 0, 0, 0)
TitleBar.BackgroundColor3 = Color3.fromRGB(255, 170, 0)
TitleBar.Text = "Gold Farm  |  By: Error"
TitleBar.TextColor3 = Color3.fromRGB(255, 255, 255)
TitleBar.TextScaled = true
TitleBar.Font = Enum.Font.SourceSansBold
TitleBar.Parent = MainFrame

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

local TitleStroke = Instance.new("UIStroke")
TitleStroke.Color = Color3.fromRGB(255, 200, 100)
TitleStroke.Thickness = 1.5
TitleStroke.Parent = TitleBar

local CloseBtn = Instance.new("TextButton")
CloseBtn.Size = UDim2.new(0, 26, 0, 26)
CloseBtn.Position = UDim2.new(1, -28, 0, 2)
CloseBtn.BackgroundColor3 = Color3.fromRGB(220, 50, 50)
CloseBtn.Text = "X"
CloseBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
CloseBtn.TextScaled = true
CloseBtn.Font = Enum.Font.SourceSansBold
CloseBtn.Parent = TitleBar

local CloseCorner = Instance.new("UICorner")
CloseCorner.CornerRadius = UDim.new(0.5, 0)
CloseCorner.Parent = CloseBtn

local langBtn = Instance.new("TextButton")
langBtn.Size = UDim2.new(0, 40, 0, 28)
langBtn.Position = UDim2.new(0, 8, 0, 38)
langBtn.BackgroundColor3 = Color3.fromRGB(80, 120, 255)
langBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
langBtn.TextScaled = true
langBtn.Font = Enum.Font.SourceSansBold
langBtn.Text = "RU"
langBtn.Parent = MainFrame

local LangCorner = Instance.new("UICorner")
LangCorner.CornerRadius = UDim.new(0, 6)
LangCorner.Parent = langBtn

local LangStroke = Instance.new("UIStroke")
LangStroke.Color = Color3.fromRGB(150, 180, 255)
LangStroke.Thickness = 1
LangStroke.Parent = langBtn

local btn = Instance.new("TextButton")
btn.Size = UDim2.new(0, 230, 0, 40)
btn.Position = UDim2.new(0, 55, 0, 38)
btn.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
btn.TextColor3 = Color3.fromRGB(255, 255, 255)
btn.TextScaled = true
btn.Font = Enum.Font.SourceSansBold
btn.Text = "Afk Farm: OFF"
btn.Parent = MainFrame

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

local BtnStroke = Instance.new("UIStroke")
BtnStroke.Color = Color3.fromRGB(255, 180, 180)
BtnStroke.Thickness = 1.5
BtnStroke.Parent = btn

local durationLabel = Instance.new("TextLabel")
durationLabel.Size = UDim2.new(0, 40, 0, 24)
durationLabel.Position = UDim2.new(0, 10, 0, 90)
durationLabel.BackgroundTransparency = 1
durationLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
durationLabel.TextScaled = true
durationLabel.Font = Enum.Font.SourceSansBold
durationLabel.Text = string.format("%.1f", STAGE_DURATION)
durationLabel.Parent = MainFrame

local minusBtn = Instance.new("TextButton")
minusBtn.Size = UDim2.new(0, 24, 0, 24)
minusBtn.Position = UDim2.new(0, 55, 0, 90)
minusBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
minusBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
minusBtn.TextScaled = true
minusBtn.Font = Enum.Font.SourceSansBold
minusBtn.Text = "-"
minusBtn.Parent = MainFrame

local MinusCorner = Instance.new("UICorner")
MinusCorner.CornerRadius = UDim.new(0, 5)
MinusCorner.Parent = minusBtn

local plusBtn = Instance.new("TextButton")
plusBtn.Size = UDim2.new(0, 24, 0, 24)
plusBtn.Position = UDim2.new(0, 85, 0, 90)
plusBtn.BackgroundColor3 = Color3.fromRGB(50, 200, 50)
plusBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
plusBtn.TextScaled = true
plusBtn.Font = Enum.Font.SourceSansBold
plusBtn.Text = "+"
plusBtn.Parent = MainFrame

local PlusCorner = Instance.new("UICorner")
PlusCorner.CornerRadius = UDim.new(0, 5)
PlusCorner.Parent = plusBtn

local speedHintLabel = Instance.new("TextLabel")
speedHintLabel.Size = UDim2.new(0, 110, 0, 24)
speedHintLabel.Position = UDim2.new(0, 115, 0, 90)
speedHintLabel.BackgroundTransparency = 1
speedHintLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
speedHintLabel.TextScaled = true
speedHintLabel.Font = Enum.Font.SourceSans
speedHintLabel.Text = "0.5 is normal"
speedHintLabel.Parent = MainFrame

local resetHintLabel = Instance.new("TextLabel")
resetHintLabel.Size = UDim2.new(0, 310, 0, 20)
resetHintLabel.Position = UDim2.new(0, 10, 0, 118)
resetHintLabel.BackgroundTransparency = 1
resetHintLabel.TextColor3 = Color3.fromRGB(255, 230, 150)
resetHintLabel.TextScaled = true
resetHintLabel.Font = Enum.Font.SourceSans
resetHintLabel.Text = "if gold didn't reset, press + 2 times"
resetHintLabel.Parent = MainFrame

local fixBtn = Instance.new("TextButton")
fixBtn.Size = UDim2.new(0, 120, 0, 28)
fixBtn.Position = UDim2.new(0, 10, 0, 145)
fixBtn.BackgroundColor3 = Color3.fromRGB(255, 140, 30)
fixBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
fixBtn.TextScaled = true
fixBtn.Font = Enum.Font.SourceSansBold
fixBtn.Text = "Fix Spawn"
fixBtn.Parent = MainFrame

local FixCorner = Instance.new("UICorner")
FixCorner.CornerRadius = UDim.new(0, 6)
FixCorner.Parent = fixBtn

local FixStroke = Instance.new("UIStroke")
FixStroke.Color = Color3.fromRGB(255, 200, 100)
FixStroke.Thickness = 1.2
FixStroke.Parent = fixBtn

--Gold/h
local goldLabel = Instance.new("TextLabel")
goldLabel.Size = UDim2.new(0, 200, 0, 24)
goldLabel.Position = UDim2.new(0, 135, 0, 145)
goldLabel.BackgroundTransparency = 1
goldLabel.TextColor3 = Color3.fromRGB(255, 255, 150)
goldLabel.TextScaled = true
goldLabel.Font = Enum.Font.SourceSansBold
goldLabel.Text = "Gold/h: 0"
goldLabel.Parent = MainFrame

-- version
local versionLabel = Instance.new("TextLabel")
versionLabel.Size = UDim2.new(0, 60, 0, 16)
versionLabel.Position = UDim2.new(1, -65, 1, -18)
versionLabel.BackgroundTransparency = 1
versionLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
versionLabel.TextScaled = true
versionLabel.Font = Enum.Font.SourceSans
versionLabel.Text = "Ver. 2.5"
versionLabel.Parent = MainFrame

local OpenButton = Instance.new("TextButton")
OpenButton.Size = UDim2.new(0, 40, 0, 40)
OpenButton.Position = UDim2.new(0, 10, 1, -50)
OpenButton.BackgroundColor3 = Color3.fromRGB(255, 200, 0)
OpenButton.TextColor3 = Color3.fromRGB(0, 0, 0)
OpenButton.TextScaled = true
OpenButton.Font = Enum.Font.SourceSansBold
OpenButton.Text = "G"
OpenButton.Visible = false
OpenButton.Parent = gui

local OpenCorner = Instance.new("UICorner")
OpenCorner.CornerRadius = UDim.new(0, 10)
OpenCorner.Parent = OpenButton

local hintLabel = Instance.new("TextLabel")
hintLabel.Size = UDim2.new(0, 300, 0, 36)
hintLabel.Position = UDim2.new(0.5, -150, 0, 8)
hintLabel.BackgroundTransparency = 1
hintLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
hintLabel.TextScaled = true
hintLabel.Font = Enum.Font.SourceSansBold
hintLabel.Text = "To Open Press G"
hintLabel.Visible = false
hintLabel.Parent = gui

local HintStroke = Instance.new("UIStroke")
HintStroke.Color = Color3.fromRGB(0, 0, 0)
HintStroke.Thickness = 2
HintStroke.Parent = hintLabel

-- ==================== other ui thing ====================
local isDragging = false
local dragStartPos = Vector2.new()
local frameStartPos = nil

TitleBar.MouseButton1Down:Connect(function()
    if not MainFrame.Visible then return end
    isDragging = true
    dragStartPos = UIS:GetMouseLocation()
    frameStartPos = MainFrame.Position
end)

TitleBar.MouseButton1Up:Connect(function()
    isDragging = false
end)

UIS.InputChanged:Connect(function(input)
    if isDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
        local delta = UIS:GetMouseLocation() - dragStartPos
        MainFrame.Position = UDim2.new(
            frameStartPos.X.Scale,
            frameStartPos.X.Offset + delta.X,
            frameStartPos.Y.Scale,
            frameStartPos.Y.Offset + delta.Y
        )
    end
end)

UIS.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        isDragging = false
    end
end)

-- ==================== logic ====================
local function updateGoldPerHour()
    if not farming then
        goldLabel.Text = russian and "Золото/ч: 0" or "Gold/h: 0"
        return
    end

    local now = tick()
    if startFarmTime == 0 then
        startFarmTime = now
    end

    if cycleStartTime > 0 then
        local cycleTime = now - cycleStartTime
        if cycleTime > 0 then
            goldPerHour = math.floor((GOLD_PER_CYCLE * 3600) / cycleTime)
        end
    end

    if (now - cycleStartTime) > 5 then
        local totalTime = now - startFarmTime
        if totalTime > 0 then
            goldPerHour = math.floor((totalGold * 3600) / totalTime)
        end
    end

    goldLabel.Text = (russian and "Золото/ч: " or "Gold/h: ") .. goldPerHour
end

local function updateUI()
    if russian then
        TitleBar.Text = "Фарм Золота  |  От: Error"
        if farming then
            btn.Text = "Афк Фарм: ВКЛ"
        else
            btn.Text = "Афк Фарм: ВЫКЛ"
            btn.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
        end
        langBtn.Text = "EN"
        speedHintLabel.Text = "0.5 норм"
        hintLabel.Text = "Чтобы открыть нажми G"
        resetHintLabel.Text = "Если золото не появится, нажми + 2 раза"
        fixBtn.Text = "Исправить спавн"
    else
        TitleBar.Text = "Gold Farm  |  By: Error"
        if farming then
            btn.Text = "Afk Farm: ON"
        else
            btn.Text = "Afk Farm: OFF"
            btn.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
        end
        langBtn.Text = "RU"
        speedHintLabel.Text = "0.5 is normal"
        hintLabel.Text = "To Open Press G"
        resetHintLabel.Text = "if gold didn't reset, press + 2 times"
        fixBtn.Text = "Fix Spawn"
    end
    durationLabel.Text = string.format("%.1f", STAGE_DURATION)
    updateGoldPerHour()
end

langBtn.MouseButton1Click:Connect(function()
    russian = not russian
    updateUI()
end)

minusBtn.MouseButton1Click:Connect(function()
    STAGE_DURATION = math.max(0.1, STAGE_DURATION - 0.1)
    updateUI()
end)

plusBtn.MouseButton1Click:Connect(function()
    STAGE_DURATION = math.min(5.0, STAGE_DURATION + 0.1)
    updateUI()
end)

fixBtn.MouseButton1Click:Connect(function()
    local char = player.Character
    if char and char:FindFirstChild("Humanoid") then
        pcall(function()
            char.Humanoid.MaxHealth = 100
            char.Humanoid.Health = 0
        end)
        if char:FindFirstChild("HumanoidRootPart") and char.Humanoid.Health > 0 then
            pcall(function() char:BreakJoints() end)
        end
        if farming then
            workspace.Gravity = originalGravity
        end
    end
end)

local function startRainbow()
    local hue = 0
    while farming do
        local color = Color3.fromHSV(hue % 1, 1, 1)
        btn.BackgroundColor3 = color
        hue = hue + 0.01
        task.wait(0.05)
    end
end

local function stopRainbow()
    if rainbowThread then
        pcall(function() coroutine.close(rainbowThread) end)
        rainbowThread = nil
    end
end

local function startHintRainbow()
    local hue = 0
    while hintLabel.Visible do
        local color = Color3.fromHSV(hue % 1, 1, 1)
        hintLabel.TextColor3 = color
        hue = hue + 0.01
        task.wait(0.05)
    end
end

local function stopHintRainbow()
    if hintRainbowThread then
        pcall(function() coroutine.close(hintRainbowThread) end)
        hintRainbowThread = nil
    end
end

local function isAlive(char)
    return char and char:FindFirstChild("Humanoid") and char.Humanoid.Health > 0
end

local function applyGodMode(char)
    if not GOD_MODE_ENABLED then return end
    local hum = char and char:FindFirstChild("Humanoid")
    if hum then
        pcall(function()
            hum.MaxHealth = 1e9
            hum.Health = 1e9
        end)
    end
end

local function collectGoldNearby(char)
    if not isAlive(char) then return end
    local hrp = char:FindFirstChild("HumanoidRootPart")
    if not hrp then return end

    local goldNames = {"gold", "goldnugget", "coin", "money", "ingot", "goldpiece"}
    local function isGoldPart(p)
        if not p:IsA("BasePart") then return false end
        local n = p.Name:lower()
        for _, kw in ipairs(goldNames) do
            if n:find(kw) then return true end
        end
        if p.Parent and p.Parent ~= workspace then
            local pn = p.Parent.Name:lower()
            for _, kw in ipairs(goldNames) do
                if pn:find(kw) then return true end
            end
        end
        return false
    end

    for _, part in ipairs(workspace:GetDescendants()) do
        if isGoldPart(part) and (part.Position - hrp.Position).Magnitude <= GOLD_COLLECT_RADIUS then
            pcall(function()
                firetouchinterest(hrp, part, 0)
                firetouchinterest(hrp, part, 1)
            end)
        end
    end

    local statueNames = {"gold", "statue", "treasure", "chest"}
    for _, obj in ipairs(workspace:GetDescendants()) do
        if obj:IsA("ClickDetector") then
            local parent = obj.Parent
            if parent and parent:IsA("BasePart") then
                local n = parent.Name:lower()
                for _, kw in ipairs(statueNames) do
                    if n:find(kw) and (parent.Position - hrp.Position).Magnitude <= GOLD_COLLECT_RADIUS then
                        pcall(function() fireclickdetector(obj, 50) end)
                        break
                    end
                end
            end
        end
    end
end

local function farmLoop()
    startFarmTime = tick()
    totalGold = 0
    totalCycles = 0

    while farming do
        cycleStartTime = tick()   
        repeat task.wait(0.1) until not farming or (player.Character and isAlive(player.Character))
        if not farming then break end

        local char = player.Character
        applyGodMode(char)

        for i = 1, MAX_STAGES do
            if not farming then break end

            local success = false
            repeat
                if not isAlive(player.Character) then
                    repeat task.wait(0.1) until not farming or isAlive(player.Character)
                    if not farming then break end
                    char = player.Character
                    applyGodMode(char)
                end

                local stageName = "CaveStage"..i
                local darknessPart = stages:FindFirstChild(stageName) and stages[stageName]:FindFirstChild("DarknessPart")

                if not darknessPart then
                    task.wait(0.5)
                    continue
                end

                char.HumanoidRootPart.CFrame = darknessPart.CFrame
                task.wait(0.05)
                if isAlive(char) then
                    collectGoldNearby(char)
                end

                local startTime = tick()
                while (tick() - startTime) < STAGE_DURATION and farming do
                    if not isAlive(player.Character) then break end
                    task.wait(0.05)
                end

                if isAlive(player.Character) then
                    success = true
                end
            until success or not farming

            if farming and success and isAlive(player.Character) then
                pcall(function() goldEvent:FireServer() end)
            end
        end

        totalCycles = totalCycles + 1
        totalGold = totalGold + GOLD_PER_CYCLE

        if farming then
            char = player.Character
            if char and isAlive(char) then
                char.Humanoid.Health = 0
            end
            repeat task.wait(0.1) until not farming or isAlive(player.Character)
        end
    end
end

-- update Gold/h
spawn(function()
    while true do
        updateGoldPerHour()
        task.wait(1)
    end
end)

local function stopFarmSafe()
    if farming then
        farming = false
        updateUI()
        workspace.Gravity = originalGravity
        stopRainbow()
        btn.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
    end
end

local function closeWindow()
    stopFarmSafe()
    MainFrame.Visible = false
    OpenButton.Visible = true
    hintLabel.Visible = true
    stopHintRainbow()
    hintRainbowThread = coroutine.create(startHintRainbow)
    coroutine.resume(hintRainbowThread)
end

local function openWindow()
    MainFrame.Visible = true
    OpenButton.Visible = false
    hintLabel.Visible = false
    stopHintRainbow()
end

CloseBtn.MouseButton1Click:Connect(closeWindow)
OpenButton.MouseButton1Click:Connect(openWindow)

UIS.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == Enum.KeyCode.G then
        if not MainFrame.Visible then
            openWindow()
        end
    end
end)

btn.MouseButton1Click:Connect(function()
    if not farming then
        farming = true
        updateUI()
        workspace.Gravity = LOW_GRAVITY
        task.spawn(farmLoop)
        rainbowThread = coroutine.create(startRainbow)
        coroutine.resume(rainbowThread)
    else
        farming = false
        updateUI()
        workspace.Gravity = originalGravity
        stopRainbow()
        btn.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
        if player.Character and player.Character:FindFirstChild("Humanoid") then
            player.Character.Humanoid.Health = 0
        end
    end
end)

player.CharacterAdded:Connect(function(char) end)
updateUI()
Executor compatibility changes over time. Check current reports before testing.

Script #6 About 1K+ candies per hour & More

Script #6 · About 1K+ candies per hour & MoreFree
About 1K+ candies per hourInstant claim all candy housesStatistics: house, server, candies by type, fake house, time“No server switching” mode
loadstring(game:HttpGet("https://raw.githubusercontent.com/TheRealAsu/BABFT/refs/heads/main/CandyFarm"))()
Executor compatibility changes over time. Check current reports before testing.

Script #7 Save and manage custom schematics. & More

Script #7 · Save and manage custom schematics. & MoreFree
Save and manage custom schematics.Load previously saved schematics.Build structures from saved schematic data.Browse saved schematics through an integrated interface.Select a schematic to view its name and details.Organize and reuse builds more conveniently.
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local HttpService = game:GetService("HttpService")
local RunService = game:GetService("RunService")
local Player = Players.LocalPlayer
local ROOT = "BABFT_Schematics"
local CHECK_INTERVAL = 0.3
local POSITION_TOLERANCE = 0.35
local ROTATION_TOLERANCE = math.rad(2)
local Schematics = {}
local Holograms = {}
local HologramOffset = Vector3.zero
local MoveHandles = nil
local MoveAnchor = nil
local MoveEnabled = false
local Checking = false
local LastCheck = 0
local function getFolder(playerName)
playerName = playerName or Player.Name
local blocksRoot = Workspace:FindFirstChild("Blocks")
if not blocksRoot then return nil end
return blocksRoot:FindFirstChild(playerName)
end
local function getPPart(model)
if model:IsA("BasePart") then
return model
end
local part = model:FindFirstChild("PPart", true)
if part and part:IsA("BasePart") then
return part
end
return nil
end
local function getBlocks(playerName)
local result = {}
local folder = getFolder(playerName)
if not folder then return result end
for _, model in ipairs(folder:GetChildren()) do
local part = getPPart(model)
if part then
table.insert(result, {
model = model,
part = part
})
end
end
return result
end
-- FILE SYSTEM
local function fileSystemAvailable()
return type(writefile) == "function"
and type(readfile) == "function"
and type(listfiles) == "function"
end
local function ensureDirectory()
if type(isfolder) == "function"
and type(makefolder) == "function" then
if not isfolder(ROOT) then
makefolder(ROOT)
end
return isfolder(ROOT)
end
return false
end
local function safeFileName(name)
name = name:gsub("[^%w_ %-]", "")
name = name:gsub("^%s+", "")
name = name:gsub("%s+$", "")
return name
end
local function filePath(name)
return ROOT .. "/" .. name .. ".json"
end
local function getRotation(cf)
local x, y, z = cf:ToOrientation()
return {x, y, z}
end
local function encodeProperty(value)
local kind = typeof(value)
if kind == "nil" or kind == "boolean" or kind == "number" or kind == "string" then
return {kind = kind, value = value}
elseif kind == "Vector3" then
return {kind = kind, value = {value.X, value.Y, value.Z}}
elseif kind == "Vector2" then
return {kind = kind, value = {value.X, value.Y}}
elseif kind == "Color3" then
return {kind = kind, value = {value.R, value.G, value.B}}
elseif kind == "CFrame" then
return {kind = kind, value = {value:GetComponents()}}
elseif kind == "BrickColor" then
return {kind = kind, value = value.Number}
elseif kind == "EnumItem" then
return {
kind = kind,
enumType = value.EnumType.Name,
value = value.Name
}
elseif kind == "NumberRange" then
return {kind = kind, value = {value.Min, value.Max}}
elseif kind == "UDim" then
return {kind = kind, value = {value.Scale, value.Offset}}
elseif kind == "UDim2" then
return {
kind = kind,
value = {
value.X.Scale, value.X.Offset,
value.Y.Scale, value.Y.Offset
}
}
elseif kind == "Rect" then
return {
kind = kind,
value = {
value.Min.X, value.Min.Y,
value.Max.X, value.Max.Y
}
}
elseif kind == "PhysicalProperties" then
return {
kind = kind,
value = {
value.Density, value.Friction, value.Elasticity,
value.FrictionWeight, value.ElasticityWeight
}
}
end
-- Instance references, Content values and unsupported types are skipped.
return nil
end
local function decodeProperty(data)
if type(data) ~= "table" then
return nil, false
end
local v = data.value
local kind = data.kind
if kind == "nil" then
return nil, true
elseif kind == "boolean" or kind == "number" or kind == "string" then
return v, true
elseif kind == "Vector3" then
return Vector3.new(v[1], v[2], v[3]), true
elseif kind == "Vector2" then
return Vector2.new(v[1], v[2]), true
elseif kind == "Color3" then
return Color3.new(v[1], v[2], v[3]), true
elseif kind == "CFrame" then
return CFrame.new(unpack(v)), true
elseif kind == "BrickColor" then
return BrickColor.new(v), true
elseif kind == "EnumItem" then
local enumType = Enum[data.enumType]
if enumType then
return enumType[v], true
end
elseif kind == "NumberRange" then
return NumberRange.new(v[1], v[2]), true
elseif kind == "UDim" then
return UDim.new(v[1], v[2]), true
elseif kind == "UDim2" then
return UDim2.new(v[1], v[2], v[3], v[4]), true
elseif kind == "Rect" then
return Rect.new(v[1], v[2], v[3], v[4]), true
elseif kind == "PhysicalProperties" then
return PhysicalProperties.new(v[1], v[2], v[3], v[4], v[5]), true
end
return nil, false
end
-- Team anchors. The local schematic coordinates are
-- stored relative to these anchors, allowing the same build to load on any team.
local TEAM_ANCHORS = {
Magenta = {370.9347229003906, -11.899993896484375, 531.893310546875, 0},
Yellow = {-477.9656677246094, -11.899991989135742, 759.8931884765625, 180},
Green = {-477.9656677246094, -11.899991989135742, 401.8931579589844, 180},
Blue = {370.8343200683594, -11.899991989135742, 173.49319458007812, 0},
Red = {370.8343200683594, -11.899991989135742, -184.706787109375, 0},
Black = {-477.9656677246094, -11.899991989135742, 43.893150329589844, 180},
White = {-169.56568908691406, -11.899991989135742, -494.5068664550781, 90},
}
local TEAM_NAME_ALIASES = {
Magenta = "Magenta", Yellow = "Yellow", Green = "Green", Blue = "Blue",
Red = "Red", Black = "Black", White = "White",
}
local function teamNameFromColor(teamColor)
local raw = tostring(teamColor or "")
raw = raw:gsub("TeamColor", ""):gsub("Color3%(%s*", "")
for name in pairs(TEAM_ANCHORS) do
if raw:lower():find(name:lower(), 1, true) then return name end
end
-- Roblox BrickColor names may include spaces (for example, "Bright blue").
local lower = raw:lower()
if lower:find("magenta", 1, true) then return "Magenta" end
if lower:find("yellow", 1, true) or lower:find("yeller", 1, true) then return "Yellow" end
if lower:find("green", 1, true) then return "Green" end
if lower:find("blue", 1, true) then return "Blue" end
if lower:find("red", 1, true) then return "Red" end
if lower:find("black", 1, true) then return "Black" end
if lower:find("white", 1, true) then return "White" end
return nil
end
local TeamsService = game:GetService("Teams")
-- Resolve the current player's team using the game's TeamLeader StringValues first.
-- TeamLeader may contain the player's username; Team/TeamColor are fallbacks.
local function resolveTeamForPlayer(targetPlayer)
if not targetPlayer then return nil end
for _, teamName in ipairs({"blue", "black", "magenta", "green", "red", "white", "yellow"}) do
local team = TeamsService:FindFirstChild(teamName)
local leader = team and team:FindFirstChild("TeamLeader")
if leader and leader:IsA("StringValue") and leader.Value == targetPlayer.Name then
return team
end
end
if targetPlayer.Team and targetPlayer.Team:IsA("Team") then
return targetPlayer.Team
end
local color = targetPlayer.TeamColor
for _, team in ipairs(TeamsService:GetChildren()) do
if team:IsA("Team") and color and team.TeamColor == color then
return team
end
end
return nil
end
local function teamAnchorCFrame(teamOrColor)
local name
if typeof(teamOrColor) == "Instance" and teamOrColor:IsA("Team") then
name = teamNameFromColor(teamOrColor.Name) or teamNameFromColor(teamOrColor.TeamColor)
else
name = teamNameFromColor(teamOrColor)
end
local a = name and TEAM_ANCHORS[name]
if not a then return nil end
return CFrame.new(a[1], a[2], a[3]) * CFrame.Angles(0, math.rad(a[4]), 0)
end
local function currentPlayerTeam()
return resolveTeamForPlayer(Player)
end
local function pivotFromSchematic(modelData)
local savedPivot = CFrame.new(unpack(modelData.pivot))
if modelData.coordinateSpace == "team-relative" then
local team = currentPlayerTeam()
local anchor = team and teamAnchorCFrame(team) or nil
if anchor then return (anchor * savedPivot) + HologramOffset end
warn("[Schematic] Could not resolve your team through TeamLeader/Team; using saved world coordinates.")
end
-- Backwards compatibility with older JSON files that contain world positions.
return savedPivot + HologramOffset
end
local function serializePart(part, pivot)
local relative = pivot:ToObjectSpace(part.CFrame)
local data = {
class = part.ClassName,
name = part.Name,
cf = {relative:GetComponents()},
size = {part.Size.X, part.Size.Y, part.Size.Z},
color = {part.Color.R, part.Color.G, part.Color.B},
transparency = part.Transparency,
reflectance = part.Reflectance,
material = part.Material.Name,
anchored = part.Anchored,
canCollide = part.CanCollide,
shape = nil,
meshId = nil,
textureId = nil,
properties = {}
}
if part:IsA("Part") then
data.shape = part.Shape.Name
end
if part:IsA("MeshPart") then
data.meshId = part.MeshId
data.textureId = part.TextureID
end
-- Capture as many properties as the executor exposes.
if type(getproperties) == "function" then
local ok, properties = pcall(getproperties, part)
if ok and type(properties) == "table" then
for propertyName, value in pairs(properties) do
local encodedOk, encoded = pcall(encodeProperty, value)
if encodedOk and encoded then
data.properties[propertyName] = encoded
end
end
end
end
return data
end
local function getRelativeInstancePath(root, instance)
    local segments = {}
    local current = instance
    while current and current ~= root do
        local parent = current.Parent
        if not parent then return nil end
        local sameNameIndex = 0
        for _, sibling in ipairs(parent:GetChildren()) do
            if sibling.Name == current.Name then
                sameNameIndex += 1
                if sibling == current then break end
            end
        end
        table.insert(segments, 1, {
            name = current.Name,
            class = current.ClassName,
            index = sameNameIndex
        })
        current = parent
    end
    if current ~= root then return nil end
    return segments
end

local function findByRelativeInstancePath(root, segments)
    local current = root
    for _, segment in ipairs(segments or {}) do
        local found, sameNameIndex = nil, 0
        for _, child in ipairs(current:GetChildren()) do
            if child.Name == segment.name then
                sameNameIndex += 1
                if sameNameIndex == (segment.index or 1) and child.ClassName == segment.class then
                    found = child
                    break
                end
            end
        end
        if not found then return nil end
        current = found
    end
    return current
end

-- Use BABFT public definitions to determine which properties
-- exist for each block type. This does not depend on BlockPropertiesServer.
local cachedBlockProperties
local function getBlockPropertyDefinitions(model)
    if not cachedBlockProperties then
        local ok, module = pcall(function()
            return require(game:GetService("ReplicatedStorage").Scripts.BlockProperties)
        end)
        if ok and type(module) == "table" then
            cachedBlockProperties = module
        else
            return nil
        end
    end
    local ok, definitions = pcall(function()
        return cachedBlockProperties[model.Name]
    end)
    if ok and type(definitions) == "table" then return definitions end
    return nil
end

local function serializeBlockProperties(model, definitions)
    local saved = {}
    if type(definitions) ~= "table" then return saved end
    for propertyName, definition in pairs(definitions) do
        if type(definition) == "table" and type(definition.GetState) == "function" then
            local ok, state = pcall(definition.GetState, model)
            if ok then
                local encodedOk, encoded = pcall(encodeProperty, state)
                if encodedOk and encoded then
                    saved[propertyName] = encoded
                end
            end
        end
    end
    return saved
end

-- The auxiliary ValueBase save is limited to properties recognized by the module
-- for this block; it does not dump every internal model value.
local PROPERTY_VALUE_ALIASES = {
    ["Piston length"] = {"ExtendLength"},
    ["Piston speed"] = {"Speed"},
    ["Wheel speed"] = {"MaxSpeed"},
    ["Servo angle"] = {"TargetAngle"},
    ["Fuse time"] = {"FuseTime"},
    ["Flight distance"] = {"FlightDistance"},
    ["Delay time"] = {"WaitDuration"},
    ["Reverse rotation"] = {"ReverseRotation"},
    ["Crosshairs"] = {"ShowCrosshairs"},
    ["Key"] = {"SemitoneOffset"},
    ["Grow head scale"] = {"HeadScale"},
    ["Grow height scale"] = {"HeightScale"},
    ["Grow width scale"] = {"WidthScale"},
    ["Grow depth scale"] = {"DepthScale"},
    ["Shrink head scale"] = {"HeadScale"},
    ["Shrink height scale"] = {"HeightScale"},
    ["Shrink width scale"] = {"WidthScale"},
    ["Shrink depth scale"] = {"DepthScale"},
    ["Aim"] = {"Aim"},
    ["And"] = {"And"}, ["Or"] = {"Or"},
    ["Xor"] = {"Xor"}, ["Not"] = {"Not"},
    ["Additive"] = {"Additive"}, ["Legacy"] = {"Legacy"},
}

local function serializeValueObjects(model, definitions)
    local values, allowedNames = {}, {}
    if type(definitions) ~= "table" then return values end
    for propertyName, definition in pairs(definitions) do
        if type(definition) == "table" and type(definition.GetState) == "function" then
            allowedNames[propertyName] = true
            for _, alias in ipairs(PROPERTY_VALUE_ALIASES[propertyName] or {}) do
                allowedNames[alias] = true
            end
        end
    end
    for _, obj in ipairs(model:GetDescendants()) do
        if obj:IsA("ValueBase") and allowedNames[obj.Name] then
            local path = getRelativeInstancePath(model, obj)
            if path then
                local ok, encoded = pcall(encodeProperty, obj.Value)
                if ok and encoded then
                    table.insert(values, {
                        path = path,
                        name = obj.Name,
                        class = obj.ClassName,
                        value = encoded
                    })
                end
            end
        end
    end
    return values
end

local function restoreValueObjects(model, modelData)
    if not model or not modelData or type(modelData.values) ~= "table" then return 0, 0 end
    local restored, skipped = 0, 0
    for _, saved in ipairs(modelData.values) do
        local target = findByRelativeInstancePath(model, saved.path)
        if target and target:IsA("ValueBase") and target.ClassName == saved.class then
            local decodedOk, value, valid = pcall(function()
                local v, canDecode = decodeProperty(saved.value)
                return v, canDecode
            end)
            if decodedOk and valid then
                local setOk = pcall(function() target.Value = value end)
                if setOk then restored += 1 else skipped += 1 end
            else
                skipped += 1
            end
        else
            -- The destination block does not expose this value/property: skip it.
            skipped += 1
        end
    end
    return restored, skipped
end


-- Capture BindTool structure: B1/B2/B3 tags and Beam edges between blocks.
-- IDs are stable JSON indices, not Instance references.
local function serializeBindTags(model)
    local tags = {}
    for _, tagName in ipairs({"B1", "B2", "B3", "SeatInput"}) do
        local ok, hasTag = pcall(function() return model:HasTag(tagName) end)
        if ok and hasTag then tags[#tags + 1] = tagName end
    end
    return tags
end

local function getBindingActionMap(model)
    local result = {}
    for _, child in ipairs(model:GetChildren()) do
        if child.Name:sub(1, 4) == "Bind" and child.Name ~= "BindingSB" then
            local action = child:FindFirstChild("ActionName")
            if action and action:IsA("ValueBase") and type(action.Value) == "string" then
                local keyCode
                for _, value in ipairs(child:GetDescendants()) do
                    if value:IsA("ValueBase") and
                        (value.Name == "KeyCode" or value.Name == "KeyCodeValue" or value.Name == "Key") then
                        if type(value.Value) == "number" then
                            keyCode = value.Value
                            break
                        end
                    end
                end
                result[action.Value] = {
                    bindName = child.Name,
                    keyCode = keyCode
                }
            end
        end
    end
    return result
end

local function serializeBindConnections(models)
    local idByModel = {}
    for index, entry in ipairs(models) do
        idByModel[entry.model] = index
    end
    local connections, seen = {}, {}
    for _, entry in ipairs(models) do
        local sourceModel = entry.model
        for _, object in ipairs(sourceModel:GetDescendants()) do
            if object:IsA("Beam") and object.Attachment0 and object.Attachment1 then
                local function ownerFromAttachment(attachment)
                    local parent = attachment.Parent
                    local candidate = parent and parent.Parent
                    if candidate and candidate:IsA("Model") then return candidate end
                    return candidate and candidate:FindFirstAncestorOfClass("Model") or nil
                end
                local a = ownerFromAttachment(object.Attachment0)
                local b = ownerFromAttachment(object.Attachment1)
                local aid, bid = idByModel[a], idByModel[b]
                if aid and bid and aid ~= bid then
                    local left, right = math.min(aid, bid), math.max(aid, bid)
                    local key = tostring(left) .. ":" .. tostring(right)
                    if not seen[key] then
                        seen[key] = true
                        local actionSource, actionSourceId = a, aid
                        if not a:HasTag("B1") and b:HasTag("B1") then
                            actionSource, actionSourceId = b, bid
                        end
                        local actionNames = {}
                        for actionName in pairs(getBindingActionMap(actionSource) or {}) do
                            actionNames[#actionNames + 1] = actionName
                        end
                        table.sort(actionNames)
                        connections[#connections + 1] = {
                            a = aid,
                            b = bid,
                            actionSource = actionSourceId,
                            aTags = serializeBindTags(a),
                            bTags = serializeBindTags(b),
                            actions = actionNames
                        }
                    end
                end
            end
        end
    end
    return connections
end

local function serializeModel(model, sourceAnchor)
local worldPivot = model:GetPivot()
local pivot = sourceAnchor and sourceAnchor:ToObjectSpace(worldPivot) or worldPivot
local parts = {}
for _, obj in ipairs(model:GetDescendants()) do
if obj:IsA("BasePart") then
table.insert(parts, serializePart(obj, worldPivot))
end
end
local mainPart = getPPart(model)
local mainRelative = nil
if mainPart then
mainRelative = {
worldPivot:ToObjectSpace(mainPart.CFrame):GetComponents()
}
end
local propertyDefinitions = getBlockPropertyDefinitions(model)
return {
name = model.Name,
pivot = {pivot:GetComponents()},
mainPart = mainRelative,
parts = parts,
bindTags = serializeBindTags(model),
bindActions = getBindingActionMap(model),
-- States are read with the same GetState method used by BABFT property UI.
blockProperties = serializeBlockProperties(model, propertyDefinitions),
values = serializeValueObjects(model, propertyDefinitions)
}
end
local function saveSchematic(name, targetPlayerName)
if not fileSystemAvailable() then
warn("This executor does not provide all required file functions.")
return false
end
if not ensureDirectory() then
warn("Could not create the schematics folder.")
return false
end
name = safeFileName(name)
if name == "" then
warn("Enter a valid name.")
return false
end
targetPlayerName = targetPlayerName or Player.Name
local targetFolder = getFolder(targetPlayerName)
if not targetFolder then
warn("Could not find a block folder for:", targetPlayerName)
return false
end
local models = getBlocks(targetPlayerName)
if #models == 0 then
warn("No blocks found for:", targetPlayerName)
return false
end
local Players = game:GetService("Players")
local sourcePlayer = Players:FindFirstChild(targetPlayerName)
local sourceTeam = resolveTeamForPlayer(sourcePlayer)
local sourceAnchor = sourceTeam and teamAnchorCFrame(sourceTeam) or nil
if not sourceAnchor then
warn("Could not identify the team/origin for", targetPlayerName, "; using legacy world coordinates.")
end
local data = {
version = 2,
coordinateSpace = sourceAnchor and "team-relative" or "world",
sourceTeam = sourceTeam and (teamNameFromColor(sourceTeam.Name) or teamNameFromColor(sourceTeam.TeamColor)) or nil,
name = name,
sourcePlayer = targetPlayerName,
blocks = {}
}
for index, entry in ipairs(models) do
local blockData = serializeModel(entry.model, sourceAnchor)
blockData.id = index
table.insert(data.blocks, blockData)
end
data.bindConnections = serializeBindConnections(models)
-- Each hologram item carries the connection table so it survives loading,
-- which otherwise keeps only each block's individual data.
for _, blockData in ipairs(data.blocks) do
    blockData.bindConnections = data.bindConnections
end
local ok, encoded = pcall(function()
return HttpService:JSONEncode(data)
end)
if not ok then
warn("JSON encoding failed:", encoded)
return false
end
local saved, err = pcall(function()
writefile(filePath(name), encoded)
end)
if not saved then
warn("Save failed:", err)
return false
end
print("Schematic saved:", name, "Blocks:", #data.blocks)
return true
end
local function listSchematics()
local result = {}
if not fileSystemAvailable() then
return result
end
if not ensureDirectory() then
return result
end
local ok, files = pcall(function()
return listfiles(ROOT)
end)
if not ok then
return result
end
for _, path in ipairs(files) do
if path:lower():match("%.json$") then
local readOk, content = pcall(function()
return readfile(path)
end)
if readOk then
local decodeOk, data = pcall(function()
return HttpService:JSONDecode(content)
end)
if decodeOk
and type(data) == "table"
and type(data.blocks) == "table" then
table.insert(result, {
name = data.name or path,
path = path,
data = data
})
end
end
end
end
table.sort(result, function(a, b)
return a.name:lower() < b.name:lower()
end)
return result
end
-- HOLOGRAM RECONSTRUCTION
local function makeCFrame(values)
return CFrame.new(
values[1], values[2], values[3],
values[4], values[5], values[6],
values[7], values[8], values[9],
values[10], values[11], values[12]
)
end
local function updateMoveAnchor()
    if not MoveAnchor or not MoveAnchor.Parent or #Holograms == 0 then return end

    local minV, maxV
    for _, item in ipairs(Holograms) do
        for _, entry in ipairs(item.parts or {}) do
            local part = entry.part
            if part and part.Parent then
                -- Compute the world-axis-aligned bounds, including each block's
                -- actual dimensions and rotation (not just its center position).
                local half = part.Size * 0.5
                local cf = part.CFrame
                for sx = -1, 1, 2 do
                    for sy = -1, 1, 2 do
                        for sz = -1, 1, 2 do
                            local corner = cf:PointToWorldSpace(Vector3.new(
                                half.X * sx, half.Y * sy, half.Z * sz
                            ))
                            minV = minV and Vector3.new(
                                math.min(minV.X, corner.X),
                                math.min(minV.Y, corner.Y),
                                math.min(minV.Z, corner.Z)
                            ) or corner
                            maxV = maxV and Vector3.new(
                                math.max(maxV.X, corner.X),
                                math.max(maxV.Y, corner.Y),
                                math.max(maxV.Z, corner.Z)
                            ) or corner
                        end
                    end
                end
            end
        end
    end

    if minV and maxV then
        local size = maxV - minV
        -- Handles are drawn around the Adornee's faces, so make it span
        -- the entire schematic instead of using a 1x1x1 anchor.
        MoveAnchor.Size = Vector3.new(
            math.max(size.X, 0.2),
            math.max(size.Y, 0.2),
            math.max(size.Z, 0.2)
        )
        MoveAnchor.CFrame = CFrame.new((minV + maxV) / 2)
    end
end

local function setMoveMode(enabled)
    MoveEnabled = enabled and #Holograms > 0
    if MoveAnchor then MoveAnchor:Destroy(); MoveAnchor = nil end
    if MoveEnabled then
        local folder = Workspace:FindFirstChild("Hologram") or Workspace
        MoveAnchor = Instance.new("Part")
        MoveAnchor.Name = "SchematicMoveAnchor"
        MoveAnchor.Size = Vector3.new(1,1,1)
        MoveAnchor.Transparency = 1
        MoveAnchor.Anchored = true
        MoveAnchor.CanCollide = false
        MoveAnchor.CanTouch = false
        MoveAnchor.CanQuery = false
        MoveAnchor.CFrame = CFrame.new()
        MoveAnchor.Parent = folder
        updateMoveAnchor()
        if MoveHandles then
            MoveHandles.Adornee = MoveAnchor
            MoveHandles.Visible = true
        end
    elseif MoveHandles then
        MoveHandles.Adornee = nil
        MoveHandles.Visible = false
    end
end

local function applyHologramMove(delta)
    if delta.Magnitude < 1e-5 then return end
    HologramOffset += delta
    for _, item in ipairs(Holograms) do
        item.pivot = item.pivot + delta
        for _, entry in ipairs(item.parts or {}) do
            if entry.part and entry.part.Parent then
                entry.part.CFrame = entry.part.CFrame + delta
            end
        end
    end
    updateMoveAnchor()
end

local function removeHolograms()
Checking = false
MoveEnabled = false
HologramOffset = Vector3.zero
if MoveHandles then MoveHandles.Adornee = nil; MoveHandles.Visible = false end
if MoveAnchor then MoveAnchor:Destroy(); MoveAnchor = nil end
for _, item in ipairs(Holograms) do
if item.model and item.model.Parent then
item.model:Destroy()
end
end
table.clear(Holograms)
local folder = Workspace:FindFirstChild("Hologram")
if folder then
for _, obj in ipairs(folder:GetChildren()) do
if obj:GetAttribute("SchematicGhost") then
obj:Destroy()
end
end
end
end
local function getHologramFolder()
local folder = Workspace:FindFirstChild("Hologram")
if not folder then
folder = Instance.new("Folder")
folder.Name = "Hologram"
folder.Parent = Workspace
end
return folder
end
local function reconstructPart(data, parent, pivot)
local class = data.class
local part
if class == "MeshPart"
and type(data.meshId) == "string"
and data.meshId ~= "" then
part = Instance.new("MeshPart")
pcall(function()
part.MeshId = data.meshId
part.TextureID = data.textureId or ""
end)
else
part = Instance.new("Part")
if data.shape then
pcall(function()
part.Shape = Enum.PartType[data.shape]
end)
end
end
part.Name = data.name or "PPart"
-- Restore captured properties individually. Any unsupported/read-only
-- property is skipped without stopping the rest of the reconstruction.
local properties = data.properties
if type(properties) == "table" then
for propertyName, encoded in pairs(properties) do
-- Position/orientation are applied from the relative schematic
-- transform below; visual/ghost settings are forced afterward.
local protected = {
Parent = true,
Name = true,
CFrame = true,
Position = true,
Orientation = true,
Rotation = true,
PivotOffset = true,
AssemblyRootPart = true,
AssemblyCenterOfMass = true,
AssemblyLinearVelocity = true,
AssemblyAngularVelocity = true,
ReceiveAge = true,
NetworkOwnershipRule = true,
UniqueId = true,
SourceAssetId = true,
MeshContent = true,
TextureContent = true
}
if not protected[propertyName] then
local decodedOk, value, valid = pcall(function()
local v, canDecode = decodeProperty(encoded)
return v, canDecode
end)
if decodedOk and valid then
pcall(function()
part[propertyName] = value
end)
end
end
end
end
-- Fallback for older schematic files and properties that could not be
-- serialized by getproperties().
pcall(function()
part.Size = Vector3.new(data.size[1], data.size[2], data.size[3])
end)
pcall(function()
part.Color = Color3.new(data.color[1], data.color[2], data.color[3])
end)
pcall(function()
part.Reflectance = data.reflectance or 0
end)
pcall(function()
part.Material = Enum.Material[data.material]
end)
part.Anchored = true
part.CanCollide = false
part.CanTouch = false
-- Keep schematic ghosts out of the game's building raycasts. Selection is
-- performed in screen space below, so CanQuery can safely stay false.
part.CanQuery = false
part.CastShadow = false
-- Keep holograms semi-transparent and place each part relative to pivot.
pcall(function()
part.Transparency = math.max(data.transparency or 0, 0.5)
end)
part.CFrame = pivot * makeCFrame(data.cf)
part:SetAttribute("SchematicGhost", true)
part.Parent = parent
return part
end
local function createErrorLabel(adornee, modelName)
if not adornee then
return nil
end
local billboard = Instance.new("BillboardGui")
billboard.Name = "SchematicErrorLabel"
billboard.Adornee = adornee
billboard.Size = UDim2.fromOffset(260, 70)
billboard.StudsOffset = Vector3.new(0, 2.8, 0)
billboard.AlwaysOnTop = true
billboard.Enabled = false
local label = Instance.new("TextLabel")
label.Name = "Message"
label.Size = UDim2.fromScale(1, 1)
label.BackgroundColor3 = Color3.fromRGB(25, 22, 10)
label.BackgroundTransparency = 0.15
label.BorderSizePixel = 0
label.TextColor3 = Color3.fromRGB(255, 220, 40)
label.TextStrokeTransparency = 0.35
label.TextWrapped = true
label.TextXAlignment = Enum.TextXAlignment.Left
label.TextYAlignment = Enum.TextYAlignment.Center
label.Font = Enum.Font.GothamSemibold
label.TextSize = 12
label.Text = ""
label.Parent = billboard
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 5)
corner.Parent = label
billboard.Parent = adornee
return billboard, label
end
local ShowMissingBlockMessages = false -- Compatibilidade
local ShowAllHologramMessages = false
local ShowHolograms = true
local function applyHologramVisibility()
for _, item in ipairs(Holograms) do
if item.model and item.model.Parent then
for _, descendant in ipairs(item.model:GetDescendants()) do
if descendant:IsA("BasePart") then
descendant.LocalTransparencyModifier = ShowHolograms and 0 or 1
end
end
end
if item.errorBillboard and item.errorBillboard.Parent then
item.errorBillboard.Enabled = ShowAllHologramMessages and ShowHolograms
and item.errorMessage ~= nil and item.errorMessage ~= ""
end
end
end
local function setErrorMessage(item, message, enabled)
item.errorMessage = message or ""
local shouldShow = ShowAllHologramMessages and ShowHolograms
and enabled == true and message ~= nil and message ~= ""
if item.errorBillboard and item.errorBillboard.Parent then
item.errorBillboard.Enabled = shouldShow
end
if item.errorLabel and item.errorLabel.Parent then
item.errorLabel.Text = message or ""
end
end
local function createHologram(modelData, folder)
local ghost = Instance.new("Model")
ghost.Name = modelData.name or "SchematicGhost"
ghost:SetAttribute("SchematicGhost", true)
local pivot = pivotFromSchematic(modelData)
local parts = {}
for _, partData in ipairs(modelData.parts) do
local ok, part = pcall(function()
return reconstructPart(partData, ghost, pivot)
end)
if ok and part then
table.insert(parts, {
part = part,
data = partData
})
end
end
local mainPart = nil
if modelData.mainPart then
local expectedCF = pivot * makeCFrame(modelData.mainPart)
local bestDistance = math.huge
for _, entry in ipairs(parts) do
local distance =
(entry.part.Position - expectedCF.Position).Magnitude
if distance < bestDistance then
bestDistance = distance
mainPart = entry.part
end
end
end
if not mainPart and #parts > 0 then
mainPart = parts[1].part
end
ghost.PrimaryPart = mainPart
local errorBillboard, errorLabel = createErrorLabel(mainPart, ghost.Name)
ghost.Parent = folder
table.insert(Holograms, {
model = ghost,
pivot = pivot,
parts = parts,
data = modelData,
status = "missing",
errorBillboard = errorBillboard,
errorLabel = errorLabel,
errorMessage = "MISSING: no block found at this position"
})
return ghost
end
local function getSchematicInventoryReport(blocks)
local dataFolder = Player:FindFirstChild("Data")
if not dataFolder then
return false, {"Could not read Player.Data"}
end

-- Count only block types actually present in the loaded schematic.
-- If Player.Data has no matching ValueBase, do not invent a zero-stock entry
-- for that name: it is not a readable inventory item and should not be listed.
local required = {}
for _, item in ipairs(blocks or {}) do
    local modelData = item and item.data
    local name = modelData and modelData.name
    if type(name) == "string" and name ~= "" then
        required[name] = (required[name] or 0) + 1
    end
end

local missing = {}
for name, needed in pairs(required) do
    local value = dataFolder:FindFirstChild(name)
    if value and value:IsA("ValueBase") then
        local available = tonumber(value.Value)
        if available and available < needed then
            table.insert(missing, {
                name = name,
                needed = needed,
                available = available,
                short = needed - available
            })
        end
    end
end

table.sort(missing, function(a, b) return a.name < b.name end)
return #missing == 0, missing
end
local function showInventoryReport(blocks)
local enough, missing = getSchematicInventoryReport(blocks)
if enough then
local total = #blocks
print(string.format("[Schematic] Inventory OK: materials available for all %d blocks.", total))
return true, string.format("Materials OK | %d blocks", total)
end
warn("[Schematic] INSUFFICIENT MATERIALS — unavailable blocks will be skipped:")
for _, item in ipairs(missing) do
warn(string.format("  %s: need %d, have %d, missing %d", item.name, item.needed, item.available, item.short))
end
local summary = {}
for _, item in ipairs(missing) do
table.insert(summary, string.format("%s: missing %d (needs %d, has %d)", item.name, item.short, item.needed, item.available))
end
return false, "Missing materials: " .. table.concat(summary, " | ")
end
local function loadSchematic(entry)
removeHolograms()
local folder = getHologramFolder()
for _, modelData in ipairs(entry.data.blocks) do
modelData.coordinateSpace = entry.data.coordinateSpace or modelData.coordinateSpace
createHologram(modelData, folder)
end
Checking = true
showInventoryReport(Holograms)
print(
"Schematic loaded:",
entry.name,
"Blocks:",
#Holograms
)
end
-- BLOCK COMPARISON
local function angleDifference(a, b)
return math.abs(math.atan2(
math.sin(a - b),
math.cos(a - b)
))
end
local function rotationsMatch(a, b)
local ax, ay, az = a:ToOrientation()
local bx, by, bz = b:ToOrientation()
return angleDifference(ax, bx) <= ROTATION_TOLERANCE
and angleDifference(ay, by) <= ROTATION_TOLERANCE
and angleDifference(az, bz) <= ROTATION_TOLERANCE
end
-- Spatial index to avoid comparing every hologram with every block.
-- A tolerância de posição continua sendo exatamente POSITION_TOLERANCE.
local SPATIAL_CELL_SIZE = 2
local function spatialCell(position)
return math.floor(position.X / SPATIAL_CELL_SIZE),
math.floor(position.Y / SPATIAL_CELL_SIZE),
math.floor(position.Z / SPATIAL_CELL_SIZE)
end
local function buildBlockSpatialIndex(blocks)
local index = {}
for _, entry in ipairs(blocks) do
local x, y, z = spatialCell(entry.part.Position)
local key = x .. ":" .. y .. ":" .. z
local cell = index[key]
if not cell then
cell = {}
index[key] = cell
end
table.insert(cell, entry)
end
return index
end
local function findBlockAt(position, spatialIndex)
local cx, cy, cz = spatialCell(position)
local best, bestDistance = nil, POSITION_TOLERANCE
local radius = math.ceil(POSITION_TOLERANCE / SPATIAL_CELL_SIZE) + 1
for x = cx - radius, cx + radius do
for y = cy - radius, cy + radius do
for z = cz - radius, cz + radius do
local cell = spatialIndex[x .. ":" .. y .. ":" .. z]
if cell then
for _, entry in ipairs(cell) do
local distance = (entry.part.Position - position).Magnitude
if distance <= bestDistance then
best = entry
bestDistance = distance
end
end
end
end
end
end
return best
end
local function setStatus(item, status)
item.status = status
if status == "correct" then
setErrorMessage(item, "", false)
elseif status == "missing" then
setErrorMessage(item, "MISSING: place " .. tostring(item.data.name or "este bloco"), true)
elseif status == "wrong_type" then
setErrorMessage(item, item.errorMessage ~= "" and item.errorMessage or "WRONG BLOCK TYPE", true)
elseif status == "wrong_properties" then
setErrorMessage(item, item.errorMessage ~= "" and item.errorMessage or "PROPERTY MISMATCH", true)
end
local color
if status == "correct" then
color = Color3.fromRGB(0, 255, 120)
elseif status == "wrong_type" then
color = Color3.fromRGB(255, 35, 35)
elseif status == "wrong_properties" then
color = Color3.fromRGB(255, 210, 0)
else
color = Color3.fromRGB(0, 220, 255)
end
for _, entry in ipairs(item.parts) do
local part = entry.part
if part and part.Parent then
part.Color = color
if status == "correct" then
part.Transparency = 1
else
part.Transparency = 0.35
end
end
end
end
local function compareBlocks(force)
-- Full comparison searches for each hologram among ALL real blocks.
-- With thousands of parts, this costs O(holograms * blocks) every 0.3 seconds.
-- If floating messages are disabled, there is no reason to run this scanner.
if not force and (not Checking or not ShowAllHologramMessages) then
return
end
local blocks = getBlocks()
local spatialIndex = buildBlockSpatialIndex(blocks)
for _, item in ipairs(Holograms) do
local expected = item.data
local pivot = item.pivot
local mainPosition = pivot.Position
if expected.mainPart then
mainPosition =
(pivot * makeCFrame(expected.mainPart)).Position
end
local found = findBlockAt(mainPosition, spatialIndex)
if not found then
item.errorMessage = "MISSING: place " .. tostring(expected.name or "este bloco")
setStatus(item, "missing")
elseif found.model.Name ~= expected.name then
item.errorMessage = "TIPO: esperado " .. tostring(expected.name)
.. " | found " .. tostring(found.model.Name)
setStatus(item, "wrong_type")
else
local actual = found.part
local messages = {}
-- Size is intentionally ignored: it should not trigger a yellow warning.
local expectedRotation = pivot
if expected.mainPart then
expectedRotation = pivot * makeCFrame(expected.mainPart)
end
if not rotationsMatch(actual.CFrame, expectedRotation) then
local ex, ey, ez = expectedRotation:ToOrientation()
local ax, ay, az = actual.CFrame:ToOrientation()
table.insert(messages, string.format(
"Rotation: expected %.0f, %.0f, %.0f° | actual %.0f, %.0f, %.0f°",
math.deg(ex), math.deg(ey), math.deg(ez),
math.deg(ax), math.deg(ay), math.deg(az)
))
end
if #messages == 0 then
item.errorMessage = ""
setStatus(item, "correct")
else
item.errorMessage = table.concat(messages, "\n")
setStatus(item, "wrong_properties")
end
end
end
end
-- BUILD: uses the game's BuildingTool remote and server-side validation.
local refreshStatus
local BuildRunning = false
local function findScaleTool(character, backpack)
return (backpack and backpack:FindFirstChild("ScalingTool"))
or (character and character:FindFirstChild("ScalingTool"))
end
local function getSavedPrimarySize(modelData)
if type(modelData.parts) ~= "table" then return nil end
for _, partData in ipairs(modelData.parts) do
if partData.name == "PPart" and type(partData.size) == "table" then
local x, y, z = tonumber(partData.size[1]), tonumber(partData.size[2]), tonumber(partData.size[3])
if x and y and z and x > 0 and y > 0 and z > 0 then
return Vector3.new(x, y, z)
end
end
end
return nil
end
local function capturePlacedModel(blocksFolder, before, blockName, desiredCF, claimedModels, timeout)
if not blocksFolder then return nil end
local deadline = os.clock() + (timeout or 2)
repeat
    local best, bestDistance = nil, math.huge
    for _, model in ipairs(blocksFolder:GetChildren()) do
        if not before[model] and not claimedModels[model]
            and model:IsA("Model") and model.Name == blockName then
            local part = getPPart(model)
            if part then
                local distance = (part.Position - desiredCF.Position).Magnitude
                if distance < bestDistance then
                    best, bestDistance = model, distance
                end
            end
        end
    end
    if best then
        claimedModels[best] = true
        return best
    end
    task.wait(0.03)
until os.clock() >= deadline
return nil
end
-- Retrieve the saved primary-part color from the schematic.
local function getSavedPrimaryColor(modelData)
if type(modelData.parts) ~= "table" then return nil end
for _, partData in ipairs(modelData.parts) do
if partData.name == "PPart" and type(partData.color) == "table" then
local r, g, b = tonumber(partData.color[1]), tonumber(partData.color[2]), tonumber(partData.color[3])
if r and g and b then
return Color3.new(
math.clamp(r, 0, 1),
math.clamp(g, 0, 1),
math.clamp(b, 0, 1)
)
end
end
end
return nil
end
local function buildSchematic()
if BuildRunning then
refreshStatus("Build is already running")
return
end
local loaded = Holograms
if #loaded == 0 then
refreshStatus("Load a schematic first")
return
end
-- Partial-build mode: do not cancel the entire schematic when inventory is short.
-- The per-block placement loop skips unavailable block types and continues
-- building everything for which the server accepts placement.
local enoughMaterials, inventoryMessage = showInventoryReport(loaded)
if not enoughMaterials then
    warn("[Schematic] Partial build enabled: available blocks will be placed; unavailable blocks will be skipped.")
    refreshStatus("Partial build | " .. inventoryMessage)
end
local character = Player.Character or Player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
local backpack = Player:FindFirstChildOfClass("Backpack")
local tool = (backpack and backpack:FindFirstChild("BuildingTool"))
or character:FindFirstChild("BuildingTool")
if not humanoid or not tool then
refreshStatus("BuildingTool not found")
return
end
local scaleTool = findScaleTool(character, backpack)
local scaleRemote = scaleTool and scaleTool:FindFirstChild("RF")
if scaleRemote and not scaleRemote:IsA("RemoteFunction") then scaleRemote = nil end
local paintTool = (backpack and backpack:FindFirstChild("PaintingTool"))
or (character and character:FindFirstChild("PaintingTool"))
local paintRemote = paintTool and paintTool:FindFirstChild("RF")
if paintRemote and not paintRemote:IsA("RemoteFunction") then paintRemote = nil end
local remote = tool:FindFirstChild("RF")
if not remote or not remote:IsA("RemoteFunction") then
refreshStatus("BuildingTool.RF not found")
return
end
local replicated = game:GetService("ReplicatedStorage")
local templates = replicated:FindFirstChild("BuildingParts")
local dataFolder = Player:FindFirstChild("Data")
local guiPlayer = Player:FindFirstChildOfClass("PlayerGui")
local buildGui = guiPlayer and guiPlayer:FindFirstChild("BuildGui")
local inventory = buildGui and buildGui:FindFirstChild("InventoryFrame")
local more = inventory and inventory:FindFirstChild("MoreFrame")
local anchorObj = more and more:FindFirstChild("AnchorBlock")
local anchorValue = anchorObj and anchorObj:FindFirstChild("Anchor")
local rotationObj = more and (more:FindFirstChild("CombineRotation") or more:FindFirstChild("CombineRotations"))
local rotationValue = rotationObj and (rotationObj:FindFirstChild("CombineRotation") or rotationObj:FindFirstChild("Value"))
local bindObj = more and more:FindFirstChild("MakeBinds")
local bindValue = bindObj and bindObj:FindFirstChild("MakeBinds")
-- Force the requested BuildingTool defaults for this build.
if anchorValue and anchorValue:IsA("BoolValue") then anchorValue.Value = true end
if rotationValue and rotationValue:IsA("BoolValue") then rotationValue.Value = false end
if bindValue and bindValue:IsA("BoolValue") then bindValue.Value = false end
if not templates or not dataFolder then
refreshStatus("BuildingParts or Player.Data not found")
return
end
local resolvedTeam = currentPlayerTeam()
local teamColor = resolvedTeam and resolvedTeam.TeamColor or Player.TeamColor
local zone = Workspace:FindFirstChild(tostring(teamColor) .. "Zone")
if not zone or not zone:IsA("BasePart") then
refreshStatus("Team zone not found")
return
end
-- Use the plot zone as a stable reference for every placement.
-- This avoids deriving the transform from an arbitrary existing block or camera state.
local target = zone
local allBlocksRoot = Workspace:FindFirstChild("Blocks")
local playerBlocks = allBlocksRoot and allBlocksRoot:FindFirstChild(Player.Name)
local blocksFolder = playerBlocks
BuildRunning = true
refreshStatus("Equipping BuildingTool...")
pcall(function() humanoid:EquipTool(tool) end)
task.spawn(function()
local placedCount, failedCount = 0, 0
local templateCache = {}
local countValueCache = {}
local secondPassQueue = {}
local claimedModels = {}
local placedModelsByIndex = {}
local paintQueue = {}
local scaleQueue = {}
local PAINT_BATCH_SIZE = 30
local SCALE_BATCH_SIZE = 30
-- Colocação em lotes de 50; ferramentas secundárias em lotes de 30.
local PLACEMENTS_PER_BATCH = 30
local BATCH_DELAY = 0.03
local function flushPaintQueue()
if not paintRemote or #paintQueue == 0 then
 table.clear(paintQueue)
 return
end
local queue = paintQueue
paintQueue = {}
for startIndex = 1, #queue, PAINT_BATCH_SIZE do
 local batch = {}
 local endIndex = math.min(startIndex + PAINT_BATCH_SIZE - 1, #queue)
 for i = startIndex, endIndex do
  batch[#batch + 1] = queue[i]
 end
 local okPaint, paintErr = pcall(function()
  paintRemote:InvokeServer(batch)
 end)
 if not okPaint then
  warn("[Schematic Build] Paint batch failed:", paintErr)
 end
end
end

local function flushScaleQueue()
if not scaleRemote or #scaleQueue == 0 then
 table.clear(scaleQueue)
 return
end
local queue = scaleQueue
scaleQueue = {}
for batchStart = 1, #queue, SCALE_BATCH_SIZE do
 local batchEnd = math.min(batchStart + SCALE_BATCH_SIZE - 1, #queue)
 local total = batchEnd - batchStart + 1
 local finished = 0
 for i = batchStart, batchEnd do
  local entry = queue[i]
  task.spawn(function()
   local okScale, scaleErr = pcall(function()
    scaleRemote:InvokeServer(entry.model, entry.size, entry.cframe)
   end)
   if not okScale then
    warn("[Schematic Build] ScalingTool failed for", entry.blockName, scaleErr)
   end
   finished += 1
  end)
 end
 while finished < total and BuildRunning do
  task.wait()
 end
end
end

local function processItem(index, item)
if not BuildRunning then return end
local modelData = item.data
local blockName = modelData.name
local template = templateCache[blockName]
if template == nil then
    template = templates:FindFirstChild(blockName) or false
    templateCache[blockName] = template
end
local countValue = countValueCache[blockName]
if countValue == nil then
    countValue = dataFolder:FindFirstChild(blockName) or false
    countValueCache[blockName] = countValue
end
if template == false then template = nil end
if countValue == false then countValue = nil end
if not template or not template:IsA("Model") then
failedCount += 1
warn("[Schematic Build] Model not found in BuildingParts:", blockName)
elseif not template.PrimaryPart then
failedCount += 1
warn("[Schematic Build] Model has no PrimaryPart:", blockName)
elseif not countValue or not countValue:IsA("ValueBase") or countValue.Value <= 0 then
failedCount += 1
warn("[Schematic Build] No available units:", blockName)
else
local desiredCF
local okCF, resultCF = pcall(function()
local pivot = pivotFromSchematic(modelData)
if modelData.mainPart then
return pivot * makeCFrame(modelData.mainPart)
end
return pivot
end)
if okCF then desiredCF = resultCF end
if not desiredCF then
failedCount += 1
warn("[Schematic Build] Invalid CFrame:", blockName)
else
local relativeCF = zone.CFrame:ToObjectSpace(desiredCF)
local anchor = true
-- Keep Create Keybinds disabled during placement. BindTool connections are
-- handled in the separate restoration pass after all blocks have been placed.
local makeBinds = false
local args = {
blockName,
countValue.Value,
target,
relativeCF,
anchor,
desiredCF,
false, -- Combine Rotation: OFF
makeBinds
}
-- Snapshot before the call. Each placement searches for a new model
-- with the expected name near the requested position; it does not use the camera or
-- a ChildAdded listener that could capture the same part across 30 calls.
local before = {}
if blocksFolder then
    for _, existing in ipairs(blocksFolder:GetChildren()) do before[existing] = true end
end
local okInvoke, result = pcall(function()
    return remote:InvokeServer(unpack(args))
end)
local newlyPlacedModel = nil
if okInvoke and result ~= false then
    newlyPlacedModel = (typeof(result) == "Instance" and
        (result:IsA("Model") and result or result:FindFirstAncestorOfClass("Model"))) or nil
    if not newlyPlacedModel or newlyPlacedModel.Parent ~= blocksFolder then
        newlyPlacedModel = capturePlacedModel(blocksFolder, before, blockName, desiredCF, claimedModels, 2)
    elseif newlyPlacedModel then
        claimedModels[newlyPlacedModel] = true
    end
end
if okInvoke and result ~= false then
placedCount += 1
if newlyPlacedModel and newlyPlacedModel.Parent == blocksFolder then
    placedModelsByIndex[index] = newlyPlacedModel
end
local propertyModel = newlyPlacedModel
if propertyModel and propertyModel.Parent == blocksFolder then
    local restored, skipped = restoreValueObjects(propertyModel, modelData)
    if skipped > 0 then
        warn("[Schematic Properties]", blockName, "values restored:", restored, "skipped:", skipped)
    end
end
-- ScalingTool: usa o modelo retornado ou capturado por nome + posição;
-- if the part cannot be identified, the tool is not applied to a random model.
local savedSize = getSavedPrimarySize(modelData)
if scaleRemote and savedSize and blocksFolder then
local placedModel = newlyPlacedModel
if placedModel and placedModel.Parent == blocksFolder then
local placedPrimary = getPPart(placedModel)
if placedPrimary then
 table.insert(scaleQueue, {model = placedModel, size = savedSize, cframe = desiredCF, blockName = blockName})
end
end
end
-- PaintingTool usa lotes de {modelo, Color3}; aplicar a cor
-- after placement to avoid one call per individual part.
local savedColor = getSavedPrimaryColor(modelData)
local placedModel = newlyPlacedModel
if paintRemote and savedColor and blocksFolder
and placedModel and placedModel.Parent == blocksFolder then
table.insert(paintQueue, {placedModel, savedColor})
-- Painting is sent after the placement batch finishes.
elseif savedColor then
warn("[Schematic Paint] Could not identify the model to paint:", blockName)
end
else
table.insert(secondPassQueue, {
index = index,
args = args,
blockName = blockName,
modelData = modelData,
desiredCF = desiredCF,
blocksFolder = blocksFolder
})
failedCount += 1
warn("[Schematic Build] Block request failed; it will be retried at the end:", blockName, result)
end
end
end
end

-- Processa a schematic em lotes de 30 chamadas concorrentes.
for batchStart = 1, #loaded, PLACEMENTS_PER_BATCH do
    if not BuildRunning then break end
    claimedModels = {}
    local batchEnd = math.min(batchStart + PLACEMENTS_PER_BATCH - 1, #loaded)
    local pendingCalls = batchEnd - batchStart + 1
    local finishedCalls = 0
    for index = batchStart, batchEnd do
        local item = loaded[index]
        task.spawn(function()
            local ok, err = pcall(processItem, index, item)
            if not ok then
                failedCount += 1
                warn("[Schematic Build] Error on block", index, err)
            end
            finishedCalls += 1
        end)
    end
    while finishedCalls < pendingCalls and BuildRunning do
        task.wait()
    end
    flushScaleQueue()
    flushPaintQueue()
    refreshStatus(string.format("Build %d/%d | placed: %d | failures: %d", batchEnd, #loaded, placedCount, failedCount))
    if batchEnd < #loaded then task.wait(BATCH_DELAY) end
end
-- Segunda passagem somente após terminar a primeira.
if BuildRunning and #secondPassQueue > 0 then
refreshStatus(string.format("First pass complete | retrying %d blocks...", #secondPassQueue))
task.wait(1)
local remainingFailures = 0
for retryIndex, pending in ipairs(secondPassQueue) do
if not BuildRunning then break end
local blocksFolder = pending.blocksFolder
local before = {}
if blocksFolder then
for _, existing in ipairs(blocksFolder:GetChildren()) do
before[existing] = true
end
end
local okRetry, retryResult = pcall(function()
return remote:InvokeServer(unpack(pending.args))
end)
local placedModel = (typeof(retryResult) == "Instance" and
(retryResult:IsA("Model") and retryResult or retryResult:FindFirstAncestorOfClass("Model"))) or nil
if not placedModel and blocksFolder then
for _, existing in ipairs(blocksFolder:GetChildren()) do
if not before[existing] and existing:IsA("Model") and getPPart(existing) then
placedModel = existing
break
end
end
end
if okRetry and retryResult ~= false then
placedCount += 1
if placedModel and placedModel.Parent == blocksFolder and pending.index then
    placedModelsByIndex[pending.index] = placedModel
end
if placedModel and placedModel.Parent == blocksFolder then
    local restored, skipped = restoreValueObjects(placedModel, pending.modelData)
    if skipped > 0 then
        warn("[Schematic Properties]", pending.blockName, "values restored:", restored, "skipped:", skipped)
    end
end
local savedSize = getSavedPrimarySize(pending.modelData)
if scaleRemote and savedSize and placedModel and placedModel.Parent == blocksFolder then
 table.insert(scaleQueue, {model = placedModel, size = savedSize, cframe = pending.desiredCF, blockName = pending.blockName})
end
local savedColor = getSavedPrimaryColor(pending.modelData)
if paintRemote and savedColor and placedModel and placedModel.Parent == blocksFolder then
table.insert(paintQueue, {placedModel, savedColor})
if #paintQueue >= PAINT_BATCH_SIZE then flushPaintQueue() end
end
else
remainingFailures += 1
warn("[Schematic Build] Second pass failed:", pending.blockName, retryResult)
end
refreshStatus(string.format("Second pass %d/%d | placed: %d | remaining failures: %d",
retryIndex, #secondPassQueue, placedCount, remainingFailures))
end
flushScaleQueue()
flushPaintQueue()
failedCount = remainingFailures
end
-- Restore connections after all blocks exist.
-- The official BindTool exposes RF:InvokeServer(actionMap, groupA, keyMap, connected, seatInput).
local function restoreBindConnections()
    local savedConnections = loaded[1] and loaded[1].data and loaded[1].data.bindConnections
    if type(savedConnections) ~= "table" or #savedConnections == 0 then
        warn("[Schematic BindTool] This schematic has no saved connections (or is from an older version).")
        return
    end
    local bindTool = (backpack and backpack:FindFirstChild("BindTool"))
        or (character and character:FindFirstChild("BindTool"))
    local bindRemote = bindTool and bindTool:FindFirstChild("RF")
    if not bindRemote or not bindRemote:IsA("RemoteFunction") then
        warn("[Schematic BindTool] BindTool.RF not found; connections were not restored.")
        return
    end
    local restored, skipped = 0, 0
    for _, edge in ipairs(savedConnections) do
        local modelA = placedModelsByIndex[edge.a]
        local modelB = placedModelsByIndex[edge.b]
        if modelA and modelB and modelA.Parent == blocksFolder and modelB.Parent == blocksFolder then
            local function tag(model, tagName)
                local ok, result = pcall(function() return model:HasTag(tagName) end)
                return ok and result
            end
            local groupA, groupB
            if tag(modelA, "B1") and (tag(modelB, "B2") or tag(modelB, "B3")) then
                groupA, groupB = {modelA}, {modelB}
            elseif tag(modelB, "B1") and (tag(modelA, "B2") or tag(modelA, "B3")) then
                groupA, groupB = {modelB}, {modelA}
            end
            if groupA and groupB then
                local actionMap, keyMap = {}, {}
                for _, source in ipairs(groupA) do
                    for _, child in ipairs(source:GetChildren()) do
                        if child.Name:sub(1, 4) == "Bind" and child.Name ~= "BindingSB" then
                            local action = child:FindFirstChild("ActionName")
                            if action and action:IsA("ValueBase") and type(action.Value) == "string" then
                                actionMap[action.Value] = actionMap[action.Value] or {}
                                table.insert(actionMap[action.Value], child)
                            end
                        end
                    end
                end
                for _, actionName in ipairs(edge.actions or {}) do
                    local savedSourceData
                    for _, hologramItem in ipairs(loaded) do
                        if hologramItem.data and hologramItem.data.id == (edge.actionSource or edge.a) then
                            savedSourceData = hologramItem.data
                            break
                        end
                    end
                    local actions = savedSourceData and savedSourceData.bindActions
                    if actions and actions[actionName] and actions[actionName].keyCode then
                        keyMap[actionName] = actions[actionName].keyCode
                    end
                end
                local seatInput = tag(groupA[1], "SeatInput") or tag(groupB[1], "SeatInput")
                local okBind, bindErr = pcall(function()
                    bindRemote:InvokeServer(actionMap, groupB, keyMap, false, seatInput)
                end)
                if okBind then
                    restored += 1
                else
                    skipped += 1
                    warn("[Schematic BindTool] Failed to restore connection:", bindErr)
                end
            else
                skipped += 1
            end
        else
            skipped += 1
        end
    end
    print("[Schematic BindTool] Ligações solicitadas:", restored, "| ignoradas:", skipped)
end
restoreBindConnections()
-- Verificação final obrigatória, mesmo sem erros detectados durante a colocação.
refreshStatus("Build submitted | waiting for blocks to appear before verification...")
task.wait(1.5)
compareBlocks(true)
local correct, missing, wrong = 0, 0, 0
for _, item in ipairs(Holograms) do
if item.status == "correct" then
correct += 1
elseif item.status == "missing" then
missing += 1
else
wrong += 1
end
end
BuildRunning = false
refreshStatus(string.format("Final check | Correct: %d | Missing: %d | Different: %d", correct, missing, wrong))
end)
end
-- UI
local gui = Instance.new("ScreenGui")
gui.Name = "BABFTSchematicUI"
gui.ResetOnSpawn = false
local parentOk = pcall(function()
gui.Parent = game:GetService("CoreGui")
end)
if not parentOk or not gui.Parent then
gui.Parent = Player:WaitForChild("PlayerGui")
end
local main = Instance.new("Frame")
main.Name = "Main"
main.Size = UDim2.fromOffset(310, 500)
main.Position = UDim2.new(0, 30, 0.3, 0)
main.BackgroundColor3 = Color3.fromRGB(25, 28, 38)
main.BorderSizePixel = 0
main.Active = true
main.Draggable = true
main.Parent = gui
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 10)
corner.Parent = main
local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, 0, 0, 38)
title.BackgroundColor3 = Color3.fromRGB(40, 45, 62)
title.BorderSizePixel = 0
title.Text = "BABFT SCHEMATICS"
title.TextColor3 = Color3.new(1, 1, 1)
title.Font = Enum.Font.GothamBold
title.TextSize = 16
title.Parent = main
local function makeButton(parent, text, y, callback)
local button = Instance.new("TextButton")
button.Size = UDim2.new(1, -20, 0, 34)
button.Position = UDim2.new(0, 10, 0, y)
button.BackgroundColor3 = Color3.fromRGB(50, 100, 175)
button.BorderSizePixel = 0
button.Text = text
button.TextColor3 = Color3.new(1, 1, 1)
button.Font = Enum.Font.GothamSemibold
button.TextSize = 13
button.Parent = parent
local c = Instance.new("UICorner")
c.CornerRadius = UDim.new(0, 6)
c.Parent = button
button.MouseButton1Click:Connect(callback)
return button
end

-- Roblox Handles: use the same axis-drag interaction as the Move tool.
MoveHandles = Instance.new("Handles")
MoveHandles.Name = "SchematicMoveHandles"
MoveHandles.Style = Enum.HandlesStyle.Movement
MoveHandles.Faces = Faces.new(Enum.NormalId.Right, Enum.NormalId.Left, Enum.NormalId.Top, Enum.NormalId.Bottom, Enum.NormalId.Front, Enum.NormalId.Back)
MoveHandles.Visible = false
MoveHandles.Parent = Player:WaitForChild("PlayerGui")
local lastDragDistance = 0
MoveHandles.MouseButton1Down:Connect(function()
    lastDragDistance = 0
end)
MoveHandles.MouseButton1Up:Connect(function()
    lastDragDistance = 0
end)
MoveHandles.MouseDrag:Connect(function(face, distance)
    if not MoveEnabled or #Holograms == 0 then return end
    local deltaDistance = distance - lastDragDistance
    lastDragDistance = distance
    local localNormal = Vector3.FromNormalId(face)
    local delta = MoveAnchor and MoveAnchor.CFrame:VectorToWorldSpace(localNormal) * deltaDistance or localNormal * deltaDistance
    applyHologramMove(delta)
end)

-- Select holograms in screen space instead of raycasting them. This lets ghost
-- parts keep CanQuery=false, so BABFT's own BuildingTool cannot snap/place blocks
-- onto the schematic merely because the user clicked it.
local Mouse = Player:GetMouse()
local UserInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
local camera = Workspace.CurrentCamera

local function pointInsideSchematicScreenBounds(mouseX, mouseY)
    camera = Workspace.CurrentCamera
    if not camera then return false end

    for _, item in ipairs(Holograms) do
        for _, entry in ipairs(item.parts or {}) do
            local part = entry.part
            if part and part.Parent and part:IsA("BasePart") then
                local cf = part.CFrame
                local half = part.Size * 0.5
                local minX, minY = math.huge, math.huge
                local maxX, maxY = -math.huge, -math.huge
                local anyOnScreen = false

                for sx = -1, 1, 2 do
                    for sy = -1, 1, 2 do
                        for sz = -1, 1, 2 do
                            local corner = cf:PointToWorldSpace(Vector3.new(
                                half.X * sx, half.Y * sy, half.Z * sz
                            ))
                            local screen, visible = camera:WorldToScreenPoint(corner)
                            if screen.Z > 0 then
                                anyOnScreen = true
                                minX = math.min(minX, screen.X)
                                minY = math.min(minY, screen.Y)
                                maxX = math.max(maxX, screen.X)
                                maxY = math.max(maxY, screen.Y)
                            end
                        end
                    end
                end

                if anyOnScreen and mouseX >= minX - 3 and mouseX <= maxX + 3
                    and mouseY >= minY - 3 and mouseY <= maxY + 3 then
                    return true
                end
            end
        end
    end
    return false
end

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if input.UserInputType ~= Enum.UserInputType.MouseButton1 then return end

    -- Ignore clicks on this script's own control panel.
    local mousePos = UserInputService:GetMouseLocation()
    local guiObjects = GuiService:GetGuiObjectsAtPosition(mousePos.X, mousePos.Y)
    for _, object in ipairs(guiObjects) do
        if object == gui or object:IsDescendantOf(gui) then
            return
        end
    end

    -- Mouse.X/Y match WorldToScreenPoint's screen coordinates.
    local clickedSchematic = pointInsideSchematicScreenBounds(Mouse.X, Mouse.Y)
    if clickedSchematic then
        if not MoveEnabled then
            setMoveMode(true)
        else
            updateMoveAnchor()
        end
        refreshStatus("Drag the arrows to move the hologram; click outside to hide them.")
    elseif MoveEnabled then
        setMoveMode(false)
        refreshStatus("Hologram movement hidden")
    end
end)

local function makeTextBox(parent, placeholder, y)
local box = Instance.new("TextBox")
box.Size = UDim2.new(1, -20, 0, 32)
box.Position = UDim2.new(0, 10, 0, y)
box.BackgroundColor3 = Color3.fromRGB(40, 44, 57)
box.BorderSizePixel = 0
box.PlaceholderText = placeholder
box.PlaceholderColor3 = Color3.fromRGB(170, 175, 190)
box.Text = ""
box.TextColor3 = Color3.new(1, 1, 1)
box.Font = Enum.Font.Gotham
box.TextSize = 13
box.ClearTextOnFocus = false
box.Parent = parent
local c = Instance.new("UICorner")
c.CornerRadius = UDim.new(0, 6)
c.Parent = box
return box
end
local nameBox = makeTextBox(main, "Schematic name...", 48)
local status = Instance.new("TextLabel")
status.Size = UDim2.new(1, -20, 0, 18)
status.Position = UDim2.new(0, 10, 1, -20)
status.BackgroundTransparency = 1
status.Text = "Ready"
status.TextColor3 = Color3.fromRGB(200, 205, 220)
status.Font = Enum.Font.Gotham
status.TextSize = 11
status.Parent = main
refreshStatus = function(text)
status.Text = text
end
local selectedSavePlayer = Player
local savePlayerButton
savePlayerButton = makeButton(main, "Save player: " .. Player.Name, 87, function()
local playerList = Players:GetPlayers()
table.sort(playerList, function(a, b) return a.Name:lower() < b.Name:lower() end)
if #playerList == 0 then return end
local currentIndex = 0
for i, candidate in ipairs(playerList) do
if candidate == selectedSavePlayer then
currentIndex = i
break
end
end
currentIndex = (currentIndex % #playerList) + 1
selectedSavePlayer = playerList[currentIndex]
savePlayerButton.Text = "Save player: " .. selectedSavePlayer.Name
refreshStatus("Source: " .. selectedSavePlayer.Name)
end)
makeButton(main, "Save Build", 127, function()
local name = nameBox.Text
if name == "" then
refreshStatus("Enter a name first!")
return
end
if saveSchematic(name, selectedSavePlayer.Name) then
refreshStatus("Saved: " .. safeFileName(name) .. " (" .. selectedSavePlayer.Name .. ")")
else
refreshStatus("Could not save schematic")
end
end)
makeButton(main, "Load Schematic", 167, function()
local old = main:FindFirstChild("SchematicList")
if old then
old:Destroy()
end
local list = Instance.new("Frame")
list.Name = "SchematicList"
list.Size = UDim2.fromOffset(280, 240)
list.Position = UDim2.new(1, 10, 0, 35)
list.BackgroundColor3 = Color3.fromRGB(28, 31, 43)
list.BorderSizePixel = 0
list.Parent = main
local c = Instance.new("UICorner")
c.CornerRadius = UDim.new(0, 8)
c.Parent = list
local heading = Instance.new("TextLabel")
heading.Size = UDim2.new(1, -40, 0, 30)
heading.Position = UDim2.new(0, 10, 0, 0)
heading.BackgroundTransparency = 1
heading.Text = "Available Schematics"
heading.TextColor3 = Color3.new(1, 1, 1)
heading.Font = Enum.Font.GothamBold
heading.TextSize = 13
heading.Parent = list
local close = Instance.new("TextButton")
close.Size = UDim2.fromOffset(28, 28)
close.Position = UDim2.new(1, -32, 0, 2)
close.BackgroundTransparency = 1
close.Text = "X"
close.TextColor3 = Color3.new(1, 1, 1)
close.Font = Enum.Font.GothamBold
close.TextSize = 14
close.Parent = list
close.MouseButton1Click:Connect(function()
list:Destroy()
end)
local scroll = Instance.new("ScrollingFrame")
scroll.Size = UDim2.new(1, -16, 1, -40)
scroll.Position = UDim2.new(0, 8, 0, 35)
scroll.BackgroundTransparency = 1
scroll.BorderSizePixel = 0
scroll.ScrollBarThickness = 5
scroll.CanvasSize = UDim2.new(0, 0, 0, 0)
scroll.AutomaticCanvasSize = Enum.AutomaticSize.Y
scroll.Parent = list
local layout = Instance.new("UIListLayout")
layout.Padding = UDim.new(0, 5)
layout.Parent = scroll
local found = listSchematics()
if #found == 0 then
local empty = Instance.new("TextLabel")
empty.Size = UDim2.new(1, -8, 0, 50)
empty.BackgroundTransparency = 1
empty.Text = "No schematics found."
empty.TextColor3 = Color3.fromRGB(190, 195, 210)
empty.Font = Enum.Font.Gotham
empty.TextSize = 12
empty.Parent = scroll
end
for _, entry in ipairs(found) do
local row = Instance.new("Frame")
row.Size = UDim2.new(1, -8, 0, 36)
row.BackgroundTransparency = 1
row.Parent = scroll
local button = Instance.new("TextButton")
button.Size = UDim2.new(1, -40, 1, 0)
button.Position = UDim2.new(0, 0, 0, 0)
button.BackgroundColor3 = Color3.fromRGB(48, 80, 125)
button.BorderSizePixel = 0
button.Text = entry.name .. " (" .. #entry.data.blocks .. " blocks)"
button.TextColor3 = Color3.new(1, 1, 1)
button.Font = Enum.Font.Gotham
button.TextSize = 12
button.TextTruncate = Enum.TextTruncate.AtEnd
button.Parent = row
local bc = Instance.new("UICorner")
bc.CornerRadius = UDim.new(0, 5)
bc.Parent = button
button.MouseButton1Click:Connect(function()
loadSchematic(entry)
local enoughMaterials, inventoryMessage = showInventoryReport(Holograms)
refreshStatus(enoughMaterials and ("Loaded: " .. entry.name .. " | " .. inventoryMessage) or inventoryMessage)
list:Destroy()
end)
local deleteButton = Instance.new("TextButton")
deleteButton.Size = UDim2.new(0, 34, 1, 0)
deleteButton.Position = UDim2.new(1, -34, 0, 0)
deleteButton.BackgroundColor3 = Color3.fromRGB(170, 55, 55)
deleteButton.BorderSizePixel = 0
deleteButton.Text = "X"
deleteButton.TextColor3 = Color3.new(1, 1, 1)
deleteButton.Font = Enum.Font.GothamBold
deleteButton.TextSize = 14
deleteButton.Parent = row
local dc = Instance.new("UICorner")
dc.CornerRadius = UDim.new(0, 5)
dc.Parent = deleteButton
deleteButton.MouseButton1Click:Connect(function()
if type(delfile) ~= "function" then
refreshStatus("This executor does not support file deletion")
return
end
local ok, err = pcall(function()
delfile(entry.path)
end)
if ok then
row:Destroy()
refreshStatus("Schematic deleted: " .. entry.name)
else
refreshStatus("Delete failed: " .. tostring(err))
end
end)
end
end)

-- IMAGE IMPORT FILE BROWSER
-- Browse folders recursively by entering them; Back returns to the previous folder.
local IMAGE_DIRS = {
    [[C:\Users\marco\AppData\Local\Xeno\workspace\Images]],
    [[workspace\Images]],
    [[Images]],
    [[C:\Users\marco\AppData\Local\Xeno\workspace]]
}

local function imageExtension(path)
    local lower = tostring(path):lower()
    return lower:match("%.png$") or lower:match("%.jpe?g$") or lower:match("%.bmp$")
end

local function normalizePath(path)
    path = tostring(path or ""):gsub("/", "\\")
    while path:find("\\\\", 1, true) and not path:match("^\\\\") do
        path = path:gsub("\\\\", "\\")
    end
    return path
end

local function joinPath(parent, child)
    parent, child = normalizePath(parent), normalizePath(child)
    if child:match("^%a:\\") or child:match("^\\\\") then return child end
    if child:lower() == parent:lower() or child:sub(1, #parent + 1):lower() == (parent .. "\\"):lower() then
        return child
    end
    -- Some executors return paths relative to their workspace, e.g. workspace\\Images\\x.png.
    local childLower, parentLower = child:lower(), parent:lower()
    local marker = parentLower:match("workspace\\(.+)$")
    if marker and childLower:sub(1, #marker + 1) == (marker .. "\\") then
        return normalizePath(parent:match("^(.*workspace)") .. "\\" .. child)
    end
    return parent:gsub("\\+$", "") .. "\\" .. child:gsub("^\\+", "")
end

local function pathIsFolder(path)
    if type(isfolder) == "function" then
        local ok, result = pcall(isfolder, path)
        if ok and result == true then return true end
    end
    return false
end

local function parentPath(path)
    path = normalizePath(path):gsub("\\+$", "")
    local parent = path:match("^(.*)\\[^\\]+$")
    if parent == "" then return nil end
    if parent and parent:match("^%a:$") then parent = parent .. "\\" end
    return parent
end

local function samePath(a, b)
    a = normalizePath(a):gsub("\\+$", "")
    b = normalizePath(b):gsub("\\+$", "")
    return a:lower() == b:lower()
end

local function listDirectory(path)
    if type(listfiles) ~= "function" then
        return nil, "Xeno listfiles() is unavailable"
    end

    path = normalizePath(path):gsub("\\+$", "")
    local attempts, attemptSeen = {}, {}
    local function addAttempt(value)
        value = normalizePath(value)
        if value ~= "" and not attemptSeen[value:lower()] then
            attemptSeen[value:lower()] = true
            attempts[#attempts + 1] = value
        end
    end

    addAttempt(path)
    local afterWorkspace = path:match("[Ww]orkspace\\(.+)$")
    if afterWorkspace then
        addAttempt("workspace\\" .. afterWorkspace)
        addAttempt(afterWorkspace)
    end
    -- Xeno may expose the same workspace through a relative Images path.
    addAttempt("Images")
    addAttempt("workspace\\Images")

    local entries, usedPath
    for _, candidate in ipairs(attempts) do
        local ok, result = pcall(listfiles, candidate)
        if ok and type(result) == "table" then
            -- Prefer the first non-empty result, but keep empty result as fallback.
            if #result > 0 then
                entries, usedPath = result, candidate
                break
            elseif entries == nil then
                entries, usedPath = result, candidate
            end
        end
    end
    if type(entries) ~= "table" then
        return nil, "Cannot open folder: " .. tostring(path)
    end

    local function workspaceRelative(value)
        value = normalizePath(value)
        local rel = value:match("^[^:]*[Ww]orkspace\\(.+)$")
        if rel then return rel end
        rel = value:match("^workspace\\(.+)$")
        if rel then return rel end
        return nil
    end

    local currentRel = workspaceRelative(path)
    local currentBase = path:match("([^\\]+)$") or path
    local normalizedEntries, seen = {}, {}

    for _, entry in ipairs(entries) do
        if type(entry) == "string" then
            local raw = normalizePath(entry)
            local fullPath

            if raw:match("^%a:\\") or raw:match("^\\\\") then
                fullPath = raw
            else
                -- If listfiles returns a workspace-relative path, map it back to
                -- the current absolute path only when it belongs to this directory.
                local rel = workspaceRelative(raw)
                if rel then
                    if currentRel then
                        local currentLower, relLower = currentRel:lower(), rel:lower()
                        if relLower:sub(1, #currentLower + 1) == currentLower .. "\\" then
                            fullPath = path .. "\\" .. rel:sub(#currentRel + 2)
                        end
                    elseif currentBase:lower() == "images" and rel:lower():sub(1, 7) == "images\\" then
                        fullPath = path .. "\\" .. rel:sub(8)
                    end
                end
                if not fullPath then
                    local rawLower, pathLower = raw:lower(), path:lower()
                    local pathTail = path:match("([^\\]+\\[^\\]+)$")
                    if rawLower:sub(1, #pathLower + 1) == pathLower .. "\\" then
                        fullPath = raw
                    elseif pathTail and rawLower:sub(1, #pathTail + 1) == pathTail:lower() .. "\\" then
                        fullPath = path .. "\\" .. raw:sub(#pathTail + 2)
                    elseif not raw:find("\\", 1, true) then
                        fullPath = path .. "\\" .. raw
                    end
                end
            end

            if fullPath then
                fullPath = normalizePath(fullPath)
                local parent = parentPath(fullPath)
                if parent and samePath(parent, path) and not seen[fullPath:lower()] then
                    seen[fullPath:lower()] = true
                    normalizedEntries[#normalizedEntries + 1] = fullPath
                end
            end
        end
    end

    -- Some executor builds do not accept absolute paths in isfolder(). Try the
    -- equivalent workspace-relative path too, so folders remain recognizable.
    local function isDirectory(entryPath)
        if pathIsFolder(entryPath) then return true end
        if type(isfolder) == "function" then
            local rel = workspaceRelative(entryPath)
            if rel then
                local candidates = {"workspace\\" .. rel, rel}
                for _, candidate in ipairs(candidates) do
                    local ok, result = pcall(isfolder, candidate)
                    if ok and result == true then return true end
                end
            end
        end
        -- Folder names usually have no extension; use this only as fallback.
        return not entryPath:match("%.[^\\]+$")
    end

    table.sort(normalizedEntries, function(a, b)
        local af, bf = isDirectory(a), isDirectory(b)
        if af ~= bf then return af end
        return a:lower() < b:lower()
    end)
    return normalizedEntries
end

local function openImageImport()
    local old = main:FindFirstChild("ImageImportWindow")
    if old then old:Destroy() end

    local popup = Instance.new("Frame")
    popup.Name = "ImageImportWindow"
    popup.Size = UDim2.fromOffset(390, 455)
    popup.Position = UDim2.new(1, 10, 0, 35)
    popup.BackgroundColor3 = Color3.fromRGB(28, 31, 43)
    popup.BorderSizePixel = 0
    popup.Parent = main
    Instance.new("UICorner", popup).CornerRadius = UDim.new(0, 8)

    local title = Instance.new("TextLabel")
    title.Size = UDim2.new(1, -44, 0, 30)
    title.Position = UDim2.fromOffset(10, 3)
    title.BackgroundTransparency = 1
    title.Text = "Import Image"
    title.TextColor3 = Color3.new(1, 1, 1)
    title.Font = Enum.Font.GothamBold
    title.TextSize = 14
    title.TextXAlignment = Enum.TextXAlignment.Left
    title.Parent = popup

    local close = Instance.new("TextButton")
    close.Size = UDim2.fromOffset(28, 28)
    close.Position = UDim2.new(1, -32, 0, 3)
    close.BackgroundTransparency = 1
    close.Text = "X"
    close.TextColor3 = Color3.new(1, 1, 1)
    close.Font = Enum.Font.GothamBold
    close.TextSize = 14
    close.Parent = popup
    close.MouseButton1Click:Connect(function() popup:Destroy() end)

    local folderLabel = Instance.new("TextLabel")
    folderLabel.Size = UDim2.new(1, -20, 0, 44)
    folderLabel.Position = UDim2.fromOffset(10, 30)
    folderLabel.BackgroundTransparency = 1
    folderLabel.Text = "PATH: (select a starting folder)"
    folderLabel.TextColor3 = Color3.fromRGB(190, 200, 220)
    folderLabel.Font = Enum.Font.Code
    folderLabel.TextSize = 10
    folderLabel.TextWrapped = true
    folderLabel.TextTruncate = Enum.TextTruncate.None
    folderLabel.TextXAlignment = Enum.TextXAlignment.Left
    folderLabel.TextYAlignment = Enum.TextYAlignment.Center
    folderLabel.Parent = popup

    local search = Instance.new("TextBox")
    search.Size = UDim2.new(1, -20, 0, 28)
    search.Position = UDim2.fromOffset(10, 77)
    search.BackgroundColor3 = Color3.fromRGB(20, 23, 32)
    search.BorderSizePixel = 0
    search.PlaceholderText = "Search image or folder..."
    search.Text = ""
    search.TextColor3 = Color3.new(1, 1, 1)
    search.PlaceholderColor3 = Color3.fromRGB(150, 155, 170)
    search.Font = Enum.Font.Gotham
    search.TextSize = 11
    search.ClearTextOnFocus = false
    search.Parent = popup
    Instance.new("UICorner", search).CornerRadius = UDim.new(0, 5)

    local back = Instance.new("TextButton")
    back.Size = UDim2.fromOffset(85, 26)
    back.Position = UDim2.fromOffset(10, 110)
    back.BackgroundColor3 = Color3.fromRGB(65, 70, 88)
    back.BorderSizePixel = 0
    back.Text = "< Back"
    back.TextColor3 = Color3.new(1, 1, 1)
    back.Font = Enum.Font.Gotham
    back.TextSize = 11
    back.Parent = popup
    Instance.new("UICorner", back).CornerRadius = UDim.new(0, 5)

    local refresh = Instance.new("TextButton")
    refresh.Size = UDim2.fromOffset(85, 26)
    refresh.Position = UDim2.fromOffset(101, 110)
    refresh.BackgroundColor3 = Color3.fromRGB(48, 80, 125)
    refresh.BorderSizePixel = 0
    refresh.Text = "Refresh"
    refresh.TextColor3 = Color3.new(1, 1, 1)
    refresh.Font = Enum.Font.Gotham
    refresh.TextSize = 11
    refresh.Parent = popup
    Instance.new("UICorner", refresh).CornerRadius = UDim.new(0, 5)

    local scroll = Instance.new("ScrollingFrame")
    scroll.Size = UDim2.new(1, -20, 0, 215)
    scroll.Position = UDim2.fromOffset(10, 141)
    scroll.BackgroundColor3 = Color3.fromRGB(20, 23, 32)
    scroll.BorderSizePixel = 0
    scroll.ScrollBarThickness = 5
    scroll.CanvasSize = UDim2.new(0, 0, 0, 0)
    scroll.AutomaticCanvasSize = Enum.AutomaticSize.Y
    scroll.Parent = popup
    Instance.new("UICorner", scroll).CornerRadius = UDim.new(0, 5)
    local layout = Instance.new("UIListLayout")
    layout.Padding = UDim.new(0, 4)
    layout.Parent = scroll

    local scaleBox = Instance.new("TextBox")
    scaleBox.Size = UDim2.fromOffset(88, 25)
    scaleBox.Position = UDim2.fromOffset(10, 360)
    scaleBox.BackgroundColor3 = Color3.fromRGB(40, 44, 57)
    scaleBox.BorderSizePixel = 0
    scaleBox.Text = "10"
    scaleBox.PlaceholderText = "Studs"
    scaleBox.TextColor3 = Color3.new(1, 1, 1)
    scaleBox.Font = Enum.Font.Gotham
    scaleBox.TextSize = 11
    scaleBox.Parent = popup
    Instance.new("UICorner", scaleBox).CornerRadius = UDim.new(0, 4)

    local heightBox = Instance.new("TextBox")
    heightBox.Size = UDim2.fromOffset(72, 25)
    heightBox.Position = UDim2.fromOffset(104, 360)
    heightBox.BackgroundColor3 = Color3.fromRGB(40, 44, 57)
    heightBox.BorderSizePixel = 0
    heightBox.Text = "0.2"
    heightBox.PlaceholderText = "Size Y"
    heightBox.TextColor3 = Color3.new(1, 1, 1)
    heightBox.Font = Enum.Font.Gotham
    heightBox.TextSize = 11
    heightBox.Parent = popup
    Instance.new("UICorner", heightBox).CornerRadius = UDim.new(0, 4)

    local materialBox = Instance.new("TextBox")
    materialBox.Size = UDim2.fromOffset(174, 25)
    materialBox.Position = UDim2.fromOffset(184, 360)
    materialBox.BackgroundColor3 = Color3.fromRGB(40, 44, 57)
    materialBox.BorderSizePixel = 0
    materialBox.Text = "PlasticBlock"
    materialBox.PlaceholderText = "BABFT block name"
    materialBox.TextColor3 = Color3.new(1, 1, 1)
    materialBox.Font = Enum.Font.Gotham
    materialBox.TextSize = 10
    materialBox.Parent = popup
    Instance.new("UICorner", materialBox).CornerRadius = UDim.new(0, 4)

    local status = Instance.new("TextLabel")
    status.Size = UDim2.new(1, -20, 0, 34)
    status.Position = UDim2.fromOffset(10, 386)
    status.BackgroundTransparency = 1
    status.Text = "Choose an image file."
    status.TextColor3 = Color3.fromRGB(220, 220, 230)
    status.Font = Enum.Font.Gotham
    status.TextSize = 10
    status.TextWrapped = true
    status.TextXAlignment = Enum.TextXAlignment.Left
    status.Parent = popup

    local import = Instance.new("TextButton")
    import.Size = UDim2.new(1, -20, 0, 28)
    import.Position = UDim2.fromOffset(10, 411)
    import.BackgroundColor3 = Color3.fromRGB(35, 130, 85)
    import.BorderSizePixel = 0
    import.Text = "Import selected image"
    import.TextColor3 = Color3.new(1, 1, 1)
    import.Font = Enum.Font.GothamBold
    import.TextSize = 11
    import.Parent = popup
    Instance.new("UICorner", import).CornerRadius = UDim.new(0, 5)

    local currentPath, selectedPath
    local history = {}

    local function clearRows()
        for _, child in ipairs(scroll:GetChildren()) do
            if child ~= layout then child:Destroy() end
        end
    end

    local render
    local function enterFolder(path)
        history[#history + 1] = currentPath
        currentPath = path
        selectedPath = nil
        render()
    end

    render = function()
        clearRows()
        folderLabel.Text = "PATH: " .. normalizePath(currentPath or "(none)")
        back.Active = #history > 0
        back.AutoButtonColor = #history > 0
        local entries, err = listDirectory(currentPath)
        if not entries then
            status.Text = err or "Could not read this folder."
            return
        end
        local query = search.Text:lower()
        local shown = 0
        for _, path in ipairs(entries) do
            if type(path) == "string" then
                path = normalizePath(path)
                local name = path:gsub("\\", "/"):match("([^/]+)$") or path
                local folder = pathIsFolder(path) or (not path:match("%.[^\\]+$"))
                local isImage = imageExtension(path)
                if (folder or isImage) and (query == "" or name:lower():find(query, 1, true)) then
                    shown += 1
                    local item = Instance.new("TextButton")
                    item.Size = UDim2.new(1, -8, 0, 27)
                    item.BackgroundColor3 = (path == selectedPath) and Color3.fromRGB(65, 100, 145)
                        or (folder and Color3.fromRGB(28, 75, 43) or Color3.fromRGB(42, 47, 62))
                    item.BorderSizePixel = 0
                    item.Text = (folder and "[DIR]  " or "[IMG]  ") .. name
                    item.TextColor3 = folder and Color3.fromRGB(100, 255, 130) or Color3.fromRGB(240, 240, 245)
                    item.Font = Enum.Font.Gotham
                    item.TextSize = 11
                    item.TextXAlignment = Enum.TextXAlignment.Left
                    item.Parent = scroll
                    Instance.new("UICorner", item).CornerRadius = UDim.new(0, 4)
                    item.MouseButton1Click:Connect(function()
                        if folder then
                            enterFolder(path)
                        else
                            selectedPath = path
                            status.Text = "Selected: " .. path
                            render()
                        end
                    end)
                end
            end
        end
        if shown == 0 then
            local empty = Instance.new("TextLabel")
            empty.Size = UDim2.new(1, -8, 0, 34)
            empty.BackgroundTransparency = 1
            empty.Text = query ~= "" and "No matching image/folder." or "No image files or subfolders."
            empty.TextColor3 = Color3.fromRGB(180, 190, 210)
            empty.Font = Enum.Font.Gotham
            empty.TextSize = 11
            empty.Parent = scroll
        end
        status.Text = selectedPath and ("Selected: " .. normalizePath(selectedPath))
            or (tostring(shown) .. " item(s) shown | folders are green.")
    end

    back.MouseButton1Click:Connect(function()
        if #history > 0 then
            currentPath = table.remove(history)
            selectedPath = nil
            render()
        end
    end)
    refresh.MouseButton1Click:Connect(render)
    search:GetPropertyChangedSignal("Text"):Connect(render)

    local function startAt(index)
        local path = IMAGE_DIRS[index]
        if path then
            local entries = listDirectory(path)
            if entries ~= nil then
                currentPath = path
                render()
                return true
            end
        end
        return false
    end

    if not startAt(1) and not startAt(2) then
        currentPath = IMAGE_DIRS[1]
        status.Text = "Couldn't open Images. Check the Xeno workspace folder."
        render()
    end

    -- Decode uncompressed 24/32-bit BMP directly. PNG/JPEG can be supplied by an
    -- executor-provided decodeImagePixels(path) function returning {width,height,pixels}.
    local function decodeBMP(path)
        local ok, bytes = pcall(readfile, path)
        if not ok or type(bytes) ~= "string" or #bytes < 54 then return nil, "Could not read BMP" end
        local function u16(i) local a,b=string.byte(bytes,i,i+1); if not b then return 0 end; return a+b*256 end
        local function u32(i) local a,b,c,d=string.byte(bytes,i,i+3); if not d then return 0 end; return a+b*256+c*65536+d*16777216 end
        if string.sub(bytes,1,2) ~= "BM" then return nil, "Not a BMP file" end
        local offset, dib = u32(11), u32(15)
        local width, height, planes, bpp, compression = u32(19), u32(23), u16(27), u16(29), u32(31)
        if dib < 40 or width < 1 or height < 1 or width > 512 or height > 512 then return nil, "BMP size/header unsupported (max 512x512)" end
        if planes ~= 1 or (bpp ~= 24 and bpp ~= 32) or compression ~= 0 then return nil, "BMP must be uncompressed 24/32-bit" end
        local stride = math.floor((width*bpp+31)/32)*4
        local pixels = {}
        for y=1,height do
            pixels[y] = {}
            local srcY = (height > 0) and (height-y) or (y-1)
            for x=1,width do
                local pos = offset + srcY*stride + (x-1)*(bpp/8) + 1
                local b,g,r,a = string.byte(bytes,pos,pos+3)
                if not r then return nil, "BMP pixel data is truncated" end
                pixels[y][x] = {r,g,b,a or 255}
            end
        end
        return {width=width,height=height,pixels=pixels}
    end

    local function decodeSelectedImage(path)
        local ext = path:lower():match("%.([%w]+)$")
        if ext == "bmp" then return decodeBMP(path) end
        local env = (type(getgenv) == "function" and getgenv()) or _G
        local decoder = rawget(env, "decodeImagePixels")
        if type(decoder) == "function" then
            local ok, result = pcall(decoder, path)
            if ok and type(result) == "table" and tonumber(result.width) and tonumber(result.height) and type(result.pixels) == "table" then
                return result
            end
            return nil, "decodeImagePixels(path) failed or returned an invalid pixel table"
        end
        return nil, "This executor has no PNG/JPG pixel decoder. Convert the image to uncompressed 24/32-bit BMP to import it."
    end

    local function importPixels(image)
        local width, height = math.floor(tonumber(image.width) or 0), math.floor(tonumber(image.height) or 0)
        if width < 1 or height < 1 or width*height > 20000 then return false, "Invalid image or over 20,000 pixels; resize it first." end
        local studs = tonumber(scaleBox.Text)
        local sizeY = tonumber(heightBox.Text)
        local blockName = materialBox.Text:gsub("^%s+", ""):gsub("%s+$", "")
        if not studs or studs <= 0 or not sizeY or sizeY <= 0 or blockName == "" then
            return false, "Enter positive Scale/Size Y and a BABFT block name."
        end
        local templates = game:GetService("ReplicatedStorage"):FindFirstChild("BuildingParts")
        if not templates or not templates:FindFirstChild(blockName) then return false, "BABFT block not found: " .. blockName end
        local zone = Workspace:FindFirstChild(tostring((currentPlayerTeam() and currentPlayerTeam().TeamColor) or Player.TeamColor) .. "Zone")
        if not zone or not zone:IsA("BasePart") then return false, "Could not find your team zone." end
        -- Scale means studs per 100 source pixels: 200x100 at scale 10 becomes 20x10 studs.
        local pixelSize = studs / 100
        local px, pz = pixelSize, pixelSize
        if px < 0.05 or sizeY < 0.05 then return false, "Block dimensions cannot be below 0.05 studs." end
        local totalWidth, totalDepth = width * px, height * pz
        local blocks = {}
        local id = 0
        -- Center image in front of the plot zone; one schematic block per non-transparent pixel.
        local origin = zone.CFrame * CFrame.new(-totalWidth/2, 2 + sizeY/2, -totalDepth/2)
        for y=1,height do
            local row = image.pixels[y]
            if type(row) == "table" then
                for x=1,width do
                    local rgba = row[x]
                    if type(rgba) == "table" then
                        local r,g,b,a = tonumber(rgba[1]),tonumber(rgba[2]),tonumber(rgba[3]),tonumber(rgba[4]) or 255
                        if r and g and b and a > 8 then
                            id += 1
                            local cf = CFrame.new((x-0.5)*px, 0, (y-0.5)*pz)
                            local partData = {class="Part",name="PPart",cf={cf:GetComponents()},size={px,sizeY,pz},color={math.clamp(r/255,0,1),math.clamp(g/255,0,1),math.clamp(b/255,0,1)},transparency=0,reflectance=0,material="SmoothPlastic",anchored=true,canCollide=false,properties={}}
                            blocks[#blocks+1] = {id=id,name=blockName,pivot={origin:GetComponents()},mainPart={cf:GetComponents()},parts={partData},coordinateSpace="world"}
                        end
                    end
                end
            end
        end
        if #blocks == 0 then return false, "No visible pixels found in image." end
        removeHolograms()
        local folder = getHologramFolder()
        for _, data in ipairs(blocks) do createHologram(data, folder) end
        Checking = true
        refreshStatus("Image loaded: " .. width .. "x" .. height .. " | " .. #blocks .. " pixels")
        print("[Import Image] Loaded", #blocks, "pixel blocks from", width .. "x" .. height)
        return true, #blocks
    end

    import.MouseButton1Click:Connect(function()
        if not selectedPath then status.Text = "Select an image first."; return end
        status.Text = "Reading image..."
        local image, err = decodeSelectedImage(selectedPath)
        if not image then
            status.Text = err or "Could not decode image."
            warn("[Import Image] " .. tostring(err))
            return
        end
        local ok, result = importPixels(image)
        if not ok then status.Text = tostring(result); warn("[Import Image] " .. tostring(result)); return end
        status.Text = "Imported " .. tostring(result) .. " pixel blocks. Click BUILD SCHEMATIC to place them."
    end)
end

local messagesButton
messagesButton = makeButton(main, "Floating Messages: OFF", 327, function()
ShowAllHologramMessages = not ShowAllHologramMessages
messagesButton.Text = "Floating Messages: " .. (ShowAllHologramMessages and "ON" or "OFF")
applyHologramVisibility()
if ShowAllHologramMessages then compareBlocks() end
end)
local hologramsButton
hologramsButton = makeButton(main, "Holograms: ON", 367, function()
ShowHolograms = not ShowHolograms
hologramsButton.Text = "Holograms: " .. (ShowHolograms and "ON" or "OFF")
applyHologramVisibility()
end)
-- Movement handles now appear automatically when the player clicks a schematic,
-- and disappear when they click anywhere outside the hologram.
makeButton(main, "BUILD SCHEMATIC", 287, function()
buildSchematic()
end)
makeButton(main, "Remove Holograms", 207, function()
removeHolograms()
refreshStatus("Holograms removed")
end)

makeButton(main, "Import Image...", 407, function()
openImageImport()
end)
makeButton(main, "Verify Now", 247, function()
compareBlocks(true)
local correct = 0
local missing = 0
local wrong = 0
for _, item in ipairs(Holograms) do
if item.status == "correct" then
correct = correct + 1
elseif item.status == "missing" then
missing = missing + 1
else
wrong = wrong + 1
end
end
refreshStatus(
"Correct: " .. correct
.. " | Missing: " .. missing
.. " | Errors: " .. wrong
)
end)
RunService.Heartbeat:Connect(function()
if Checking and os.clock() - LastCheck >= CHECK_INTERVAL then
LastCheck = os.clock()
compareBlocks()
end
end)
print("BABFT Schematics System initialized!")
Executor compatibility changes over time. Check current reports before testing.

Script #8 BABFT Script & More

Script #8 · BABFT Script & MoreFree
BABFT ScriptCandyFarm
loadstring(game:HttpGet("https://raw.githubusercontent.com/Fantom233/BABFT/refs/heads/main/CandyFarm.lua"))()
Executor compatibility changes over time. Check current reports before testing.

Script #9 It is recommended to run it on a computer. & More

Script #9 · It is recommended to run it on a computer. & MoreFree
It is recommended to run it on a computer.Functions:1. Building screens2. Image loader3. Video loader (Beta)4. Operating system
loadstring(game:HttpGet('https://hahaxio7777.dpdns.org/resources?file=BABFT_Script/Loader.lua'))()
Executor compatibility changes over time. Check current reports before testing.

Script #10 TESTED in Potassium & More

Script #10 · TESTED in Potassium & MoreFree
TESTED in Potassium📚 Full docs: https://github.com/ElChacra/warn_BuildABoat🌾 FARM:Auto Farm: clears every cave stage + claims the golden chestGodmode during the runAuto-restarts after respawn
loadstring(game:HttpGet("https://raw.githubusercontent.com/ElChacra/warn_BuildABoat/main/warn_BuildABoat.lua"))()
Executor compatibility changes over time. Check current reports before testing.

Script #11 Auto Farm Golds & More

Script #11 · Auto Farm Golds & MoreFree
Auto Farm Goldsand a few more
loadstring(game:HttpGet("https://raw.githubusercontent.com/eliassixseven09-web/arbix/refs/heads/main/Build%20a%20Boat%20For%20Treasure"))()
Executor compatibility changes over time. Check current reports before testing.

Script #12 OP GOLD FARM OP CANDY FARM OP FLY OP GOD MODE AND NOCLIP OP! & More

Script #12 · OP GOLD FARM OP CANDY FARM OP FLY OP GOD MODE AND NOCLIP OP! & MoreFree
OP GOLD FARM OP CANDY FARM OP FLY OP GOD MODE AND NOCLIP OP!
loadstring(game:HttpGet("https://raw.githubusercontent.com/nate15-24rfdc/build-a-boat-for-treasure/refs/heads/main/buildboat"))()
Executor compatibility changes over time. Check current reports before testing.

Script #13 Egg Cannon build a boat 2026 work & More

Script #13 · Egg Cannon build a boat 2026 work & MoreFree
Egg Cannon build a boat 2026 work
--// SADHUB Launcher — Roblox Executor Edition
--// Author of prompt: KillerKC2 (4cheat) crocodile_428 (ответы mail.ru)

local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local UserInputService = game:GetService("UserInputService")
local HttpService = game:GetService("HttpService")
local TweenService = game:GetService("TweenService")
local CoreGui = game:GetService("CoreGui")

local LP = Players.LocalPlayer

--// Colors
local BG            = Color3.fromRGB(10, 10, 10)
local SIDEBAR       = Color3.fromRGB(12, 12, 12)
local CARD          = Color3.fromRGB(21, 21, 21)
local CARD_HOVER    = Color3.fromRGB(30, 30, 30)
local BORDER        = Color3.fromRGB(42, 42, 42)
local BORDER_HOVER  = Color3.fromRGB(58, 58, 58)
local TEXT          = Color3.fromRGB(255, 255, 255)
local TEXT_DIM      = Color3.fromRGB(154, 154, 154)
local ACCENT        = Color3.fromRGB(0, 120, 212)
local ACCENT_HOVER  = Color3.fromRGB(30, 138, 224)
local DANGER        = Color3.fromRGB(196, 43, 28)
local GOLD          = Color3.fromRGB(255, 215, 0)
local GREEN         = Color3.fromRGB(74, 222, 128)
local CYAN          = Color3.fromRGB(122, 211, 255)

--// Games
local GAMES = {
    {id = 1930863474, name = "Egg Cannon"},
    {id = 1930866268, name = "winter place old"},
    {id = 537413528,  name = "build a boat"},
}

--// Favorites
local FAV_FILE = "sadhub_favs.json"
local favorites = {}

local function hasFileAPI()
    return type(writefile) == "function" and type(readfile) == "function" and type(isfile) == "function"
end

if hasFileAPI() then
    pcall(function()
        if isfile(FAV_FILE) then
            local data = HttpService:JSONDecode(readfile(FAV_FILE))
            for _, v in ipairs(data) do favorites[v] = true end
        end
    end)
end

local function saveFavs()
    if not hasFileAPI() then return end
    local arr = {}
    for id in pairs(favorites) do table.insert(arr, id) end
    pcall(function() writefile(FAV_FILE, HttpService:JSONEncode(arr)) end)
end

--// Helpers
local function corner(inst, r)
    local c = Instance.new("UICorner")
    c.CornerRadius = UDim.new(0, r or 8)
    c.Parent = inst
    return c
end

local function stroke(inst, color)
    local s = Instance.new("UIStroke")
    s.Color = color or BORDER
    s.Thickness = 1
    s.Parent = inst
    return s
end

local function makeBtn(parent, o)
    local b = Instance.new("TextButton")
    b.Size = o.size
    b.Position = o.pos
    b.BackgroundColor3 = o.bg or CARD_HOVER
    b.BorderSizePixel = 0
    b.Text = o.text or ""
    b.Font = o.font or Enum.Font.Gotham
    b.TextSize = o.ts or 12
    b.TextColor3 = o.fg or TEXT
    b.AutoButtonColor = false
    b.ZIndex = 3
    b.Parent = parent
    corner(b, o.radius or 6)
    if o.hover then
        b.MouseEnter:Connect(function()
            TweenService:Create(b, TweenInfo.new(0.12), {BackgroundColor3 = o.hover}):Play()
        end)
        b.MouseLeave:Connect(function()
            TweenService:Create(b, TweenInfo.new(0.12), {BackgroundColor3 = o.bg}):Play()
        end)
    end
    if o.click then b.MouseButton1Click:Connect(o.click) end
    return b
end

--// Forward decls
local refresh
local switch
local currentTab = "games"

--// ScreenGui
local gui = Instance.new("ScreenGui")
gui.Name = "SADHUB"
gui.ResetOnSpawn = false
gui.IgnoreGuiInset = true
gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
pcall(function() gui.Parent = CoreGui end)
if not gui.Parent then gui.Parent = LP:WaitForChild("PlayerGui") end

--// Window
local win = Instance.new("Frame")
win.Size = UDim2.new(0, 460, 0, 540)
win.Position = UDim2.new(0.5, -230, 0.5, -270)
win.BackgroundColor3 = BG
win.BorderSizePixel = 0
win.ClipsDescendants = true
win.Visible = false
win.Parent = gui
corner(win, 10)
stroke(win, BORDER)

--// Title bar
local titlebar = Instance.new("Frame")
titlebar.Size = UDim2.new(1, 0, 0, 34)
titlebar.BackgroundColor3 = SIDEBAR
titlebar.BorderSizePixel = 0
titlebar.ZIndex = 2
titlebar.Parent = win
corner(titlebar, 10)
local fix = Instance.new("Frame")
fix.Size = UDim2.new(1, 0, 0, 17)
fix.Position = UDim2.new(0, 0, 1, -17)
fix.BackgroundColor3 = SIDEBAR
fix.BorderSizePixel = 0
fix.ZIndex = 2
fix.Parent = titlebar

local logo = Instance.new("TextLabel")
logo.Size = UDim2.new(0, 20, 1, 0)
logo.Position = UDim2.new(0, 10, 0, 0)
logo.BackgroundTransparency = 1
logo.Text = "◆"
logo.Font = Enum.Font.GothamBold
logo.TextSize = 16
logo.TextColor3 = ACCENT
logo.ZIndex = 3
logo.Parent = titlebar

local titleLbl = Instance.new("TextLabel")
titleLbl.Size = UDim2.new(0, 220, 1, 0)
titleLbl.Position = UDim2.new(0, 32, 0, 0)
titleLbl.BackgroundTransparency = 1
titleLbl.Text = "SADHUB Launcher"
titleLbl.Font = Enum.Font.Gotham
titleLbl.TextSize = 12
titleLbl.TextColor3 = TEXT_DIM
titleLbl.TextXAlignment = Enum.TextXAlignment.Left
titleLbl.ZIndex = 3
titleLbl.Parent = titlebar

local function winBtn(text, pos, hoverColor)
    local b = Instance.new("TextButton")
    b.Size = UDim2.new(0, 40, 1, 0)
    b.Position = pos
    b.BackgroundTransparency = 1
    b.BorderSizePixel = 0
    b.Text = text
    b.Font = Enum.Font.Gotham
    b.TextSize = 14
    b.TextColor3 = TEXT
    b.ZIndex = 3
    b.Parent = titlebar
    b.MouseEnter:Connect(function()
        b.BackgroundTransparency = 0
        b.BackgroundColor3 = hoverColor
    end)
    b.MouseLeave:Connect(function()
        b.BackgroundTransparency = 1
    end)
    return b
end

local closeBtn = winBtn("✕", UDim2.new(1, -40, 0, 0), DANGER)
local minBtn   = winBtn("─", UDim2.new(1, -80, 0, 0), Color3.fromRGB(50, 50, 50))

closeBtn.MouseButton1Click:Connect(function() gui.Enabled = false end)

--// Drag
local dragging, 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 = win.Position
        input.Changed:Connect(function()
            if input.UserInputState == Enum.UserInputState.End then
                dragging = false
            end
        end)
    end
end
titlebar.InputBegan:Connect(startDrag)
titleLbl.InputBegan:Connect(startDrag)
logo.InputBegan:Connect(startDrag)

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

--// Body
local body = Instance.new("Frame")
body.Size = UDim2.new(1, 0, 1, -34)
body.Position = UDim2.new(0, 0, 0, 34)
body.BackgroundTransparency = 1
body.ZIndex = 2
body.Parent = win

--// Minimize
local minimized = false
minBtn.MouseButton1Click:Connect(function()
    minimized = not minimized
    win.Size = minimized and UDim2.new(0, 460, 0, 34) or UDim2.new(0, 460, 0, 540)
    body.Visible = not minimized
    minBtn.Text = minimized and "□" or "─"
end)

--// Sidebar
local sidebar = Instance.new("Frame")
sidebar.Size = UDim2.new(0, 140, 1, 0)
sidebar.BackgroundColor3 = SIDEBAR
sidebar.BorderSizePixel = 0
sidebar.ZIndex = 3
sidebar.Parent = body
corner(sidebar, 10)

local navBtns = {}
local function navBtn(key, text, y)
    local b = Instance.new("TextButton")
    b.Size = UDim2.new(1, -20, 0, 38)
    b.Position = UDim2.new(0, 10, 0, y)
    b.BackgroundColor3 = SIDEBAR
    b.BorderSizePixel = 0
    b.Text = text
    b.Font = Enum.Font.Gotham
    b.TextSize = 13
    b.TextColor3 = TEXT_DIM
    b.TextXAlignment = Enum.TextXAlignment.Left
    b.AutoButtonColor = false
    b.ZIndex = 4
    b.Parent = sidebar
    corner(b, 6)
    local pad = Instance.new("UIPadding")
    pad.PaddingLeft = UDim.new(0, 12)
    pad.Parent = b
    b.MouseEnter:Connect(function()
        if currentTab ~= key then b.BackgroundColor3 = Color3.fromRGB(26, 26, 26) end
    end)
    b.MouseLeave:Connect(function()
        if currentTab ~= key then b.BackgroundColor3 = SIDEBAR end
    end)
    b.MouseButton1Click:Connect(function() switch(key) end)
    navBtns[key] = b
end

navBtn("games",    "🎮  Игры",     16)
navBtn("favs",     "⭐  Избранное", 60)
navBtn("settings", "⚙  Настройки",  104)

--// Content
local content = Instance.new("Frame")
content.Size = UDim2.new(1, -140, 1, 0)
content.Position = UDim2.new(0, 140, 0, 0)
content.BackgroundTransparency = 1
content.ZIndex = 2
content.Parent = body

local pageTitle = Instance.new("TextLabel")
pageTitle.Size = UDim2.new(1, -30, 0, 30)
pageTitle.Position = UDim2.new(0, 20, 0, 16)
pageTitle.BackgroundTransparency = 1
pageTitle.Text = "Библиотека игр"
pageTitle.Font = Enum.Font.GothamBold
pageTitle.TextSize = 20
pageTitle.TextColor3 = TEXT
pageTitle.TextXAlignment = Enum.TextXAlignment.Left
pageTitle.ZIndex = 3
pageTitle.Parent = content

local pageSub = Instance.new("TextLabel")
pageSub.Size = UDim2.new(1, -30, 0, 18)
pageSub.Position = UDim2.new(0, 20, 0, 48)
pageSub.BackgroundTransparency = 1
pageSub.Text = "Запускай любимые миры в один клик"
pageSub.Font = Enum.Font.Gotham
pageSub.TextSize = 12
pageSub.TextColor3 = TEXT_DIM
pageSub.TextXAlignment = Enum.TextXAlignment.Left
pageSub.ZIndex = 3
pageSub.Parent = content

local scroll = Instance.new("ScrollingFrame")
scroll.Size = UDim2.new(1, -30, 1, -84)
scroll.Position = UDim2.new(0, 20, 0, 76)
scroll.BackgroundTransparency = 1
scroll.BorderSizePixel = 0
scroll.ScrollBarThickness = 4
scroll.ScrollBarImageColor3 = BORDER
scroll.CanvasSize = UDim2.new(0, 0, 0, 0)
scroll.ZIndex = 3
scroll.Parent = content

local listLayout = Instance.new("UIListLayout")
listLayout.Padding = UDim.new(0, 6)
listLayout.SortOrder = Enum.SortOrder.LayoutOrder
listLayout.Parent = scroll

local status = Instance.new("TextLabel")
status.Size = UDim2.new(1, -30, 0, 20)
status.Position = UDim2.new(0, 20, 1, -24)
status.BackgroundTransparency = 1
status.Text = "Готов к запуску"
status.Font = Enum.Font.Gotham
status.TextSize = 11
status.TextColor3 = TEXT_DIM
status.TextXAlignment = Enum.TextXAlignment.Left
status.ZIndex = 3
status.Parent = content

local statusToken = 0
local function setStatus(text, color)
    statusToken = statusToken + 1
    local tok = statusToken
    status.Text = text
    status.TextColor3 = color or TEXT_DIM
    task.delay(3, function()
        if tok == statusToken then
            status.Text = "Готов к запуску"
            status.TextColor3 = TEXT_DIM
        end
    end)
end

--// Card
local function buildCard(game)
    local card = Instance.new("Frame")
    card.Size = UDim2.new(1, -8, 0, 60)
    card.BackgroundColor3 = CARD
    card.BorderSizePixel = 0
    card.ZIndex = 4
    card.Parent = scroll
    corner(card, 8)
    local st = stroke(card, BORDER)

    local nameL = Instance.new("TextLabel")
    nameL.Size = UDim2.new(0, 200, 0, 18)
    nameL.Position = UDim2.new(0, 14, 0, 10)
    nameL.BackgroundTransparency = 1
    nameL.Text = game.name
    nameL.Font = Enum.Font.GothamBold
    nameL.TextSize = 13
    nameL.TextColor3 = TEXT
    nameL.TextXAlignment = Enum.TextXAlignment.Left
    nameL.ZIndex = 5
    nameL.Parent = card

    local idL = Instance.new("TextLabel")
    idL.Size = UDim2.new(0, 200, 0, 16)
    idL.Position = UDim2.new(0, 14, 0, 32)
    idL.BackgroundTransparency = 1
    idL.Text = "ID: " .. game.id
    idL.Font = Enum.Font.Code
    idL.TextSize = 10
    idL.TextColor3 = TEXT_DIM
    idL.TextXAlignment = Enum.TextXAlignment.Left
    idL.ZIndex = 5
    idL.Parent = card

    makeBtn(card, {
        text = "▶ ИГРАТЬ",
        size = UDim2.new(0, 78, 0, 30),
        pos  = UDim2.new(1, -90, 0.5, -15),
        bg = ACCENT, hover = ACCENT_HOVER,
        fg = TEXT, font = Enum.Font.GothamBold, ts = 11,
        click = function()
            setStatus("Запуск: " .. game.name, GREEN)
            local ok = pcall(function() TeleportService:Teleport(game.id, LP) end)
            if not ok then
                pcall(function() setclipboard("https://www.roblox.com/games/" .. game.id) end)
                setStatus("Ссылка скопирована", CYAN)
            end
        end,
    })

    makeBtn(card, {
        text = "📋",
        size = UDim2.new(0, 30, 0, 30),
        pos  = UDim2.new(1, -128, 0.5, -15),
        bg = CARD_HOVER, hover = Color3.fromRGB(40, 40, 40),
        fg = TEXT_DIM,
        click = function()
            pcall(function() setclipboard("https://www.roblox.com/games/" .. game.id) end)
            setStatus("Ссылка скопирована", CYAN)
        end,
    })

    local fav = makeBtn(card, {
        text = favorites[game.id] and "★" or "☆",
        size = UDim2.new(0, 30, 0, 30),
        pos  = UDim2.new(1, -164, 0.5, -15),
        bg = CARD_HOVER, hover = Color3.fromRGB(40, 40, 40),
        fg = favorites[game.id] and GOLD or TEXT_DIM,
        click = function()
            if favorites[game.id] then
                favorites[game.id] = nil
                setStatus("Убрано из избранного", TEXT_DIM)
            else
                favorites[game.id] = true
                setStatus("Добавлено в избранное", GOLD)
            end
            saveFavs()
            fav.Text = favorites[game.id] and "★" or "☆"
            fav.TextColor3 = favorites[game.id] and GOLD or TEXT_DIM
            refresh()
        end,
    })

    card.MouseEnter:Connect(function()
        card.BackgroundColor3 = CARD_HOVER
        st.Color = BORDER_HOVER
    end)
    card.MouseLeave:Connect(function()
        card.BackgroundColor3 = CARD
        st.Color = BORDER
    end)
end

--// Refresh
local function clearScroll()
    for _, c in ipairs(scroll:GetChildren()) do
        if c:IsA("Frame") or c:IsA("TextButton") or c:IsA("TextLabel") then
            c:Destroy()
        end
    end
end

refresh = function()
    clearScroll()
    local list
    if currentTab == "favs" then
        list = {}
        for _, g in ipairs(GAMES) do
            if favorites[g.id] then table.insert(list, g) end
        end
        if #list == 0 then
            local lbl = Instance.new("TextLabel")
            lbl.Size = UDim2.new(1, 0, 0, 40)
            lbl.BackgroundTransparency = 1
            lbl.Text = "Пока пусто — добавь игру звёздочкой"
            lbl.Font = Enum.Font.Gotham
            lbl.TextSize = 12
            lbl.TextColor3 = TEXT_DIM
            lbl.ZIndex = 4
            lbl.Parent = scroll
            scroll.CanvasSize = UDim2.new(0, 0, 0, 40)
            return
        end
    else
        list = GAMES
    end
    for _, g in ipairs(list) do buildCard(g) end
    scroll.CanvasSize = UDim2.new(0, 0, 0, #list * 66)
end

--// Switch
switch = function(key)
    currentTab = key
    for k, b in pairs(navBtns) do
        if k == key then
            b.TextColor3 = TEXT
            b.BackgroundColor3 = Color3.fromRGB(26, 26, 26)
        else
            b.TextColor3 = TEXT_DIM
            b.BackgroundColor3 = SIDEBAR
        end
    end

    if key == "games" then
        pageTitle.Text = "Библиотека игр"
        pageSub.Text = "Запускай любимые миры в один клик"
        refresh()
    elseif key == "favs" then
        pageTitle.Text = "Избранное"
        pageSub.Text = "Твои сохранённые игры"
        refresh()
    elseif key == "settings" then
        pageTitle.Text = "Настройки"
        pageSub.Text = "О программе"
        clearScroll()
        local info = Instance.new("TextLabel")
        info.Size = UDim2.new(1, -8, 0, 120)
        info.BackgroundColor3 = CARD
        info.BorderSizePixel = 0
        info.Text = "SADHUB Launcher v1.0 · Beta\n\nАвтор промпта:\nKillerKC2 (4cheat) / crocodile_428\n\nПереключить GUI: RightShift"
        info.Font = Enum.Font.Gotham
        info.TextSize = 12
        info.TextColor3 = TEXT_DIM
        info.TextWrapped = true
        info.ZIndex = 4
        info.Parent = scroll
        corner(info, 8)
        stroke(info, BORDER)
        scroll.CanvasSize = UDim2.new(0, 0, 0, 120)
    end
end

--// Loading Screen
local loading = Instance.new("Frame")
loading.Size = UDim2.new(0, 460, 0, 540)
loading.Position = UDim2.new(0.5, -230, 0.5, -270)
loading.BackgroundColor3 = BG
loading.BorderSizePixel = 0
loading.ZIndex = 10
loading.Parent = gui
corner(loading, 10)
local loadStroke = stroke(loading, BORDER)

local loadText = Instance.new("TextLabel")
loadText.Size = UDim2.new(1, 0, 1, 0)
loadText.BackgroundTransparency = 1
loadText.Text = "Загрузка... 1"
loadText.Font = Enum.Font.GothamBold
loadText.TextSize = 24
loadText.TextColor3 = ACCENT
loadText.ZIndex = 11
loadText.Parent = loading

task.spawn(function()
    for i = 1, 5 do
        loadText.Text = "Загрузка... " .. i
        task.wait(1)
    end
    
    loadText.Text = "сделал https://scriptblox.com/u/nopls"
    loadText.Font = Enum.Font.Gotham
    loadText.TextSize = 16
    loadText.TextColor3 = TEXT
    loadText.TextWrapped = true
    
    task.wait(2)
    
    -- Плавное исчезновение
    local info = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
    TweenService:Create(loading, info, {BackgroundTransparency = 1}):Play()
    TweenService:Create(loadText, info, {TextTransparency = 1}):Play()
    TweenService:Create(loadStroke, info, {Transparency = 1}):Play()
    
    task.wait(0.5)
    loading:Destroy()
    win.Visible = true
end)

--// Toggle GUI
UserInputService.InputBegan:Connect(function(input, gp)
    if gp then return end
    if input.KeyCode == Enum.KeyCode.RightShift then
        gui.Enabled = not gui.Enabled
    end
end)

switch("games")
Executor compatibility changes over time. Check current reports before testing.

Script #14 gets around 10-30k gold an hour & More

Script #14 · gets around 10-30k gold an hour & MoreFree
gets around 10-30k gold an hour
local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))()

local Window = Rayfield:CreateWindow({
   Name = "Babft OP GRIND",
   LoadingTitle = "Loading Interface...",
   LoadingSubtitle = "by hooky",
   ConfigurationSaving = { Enabled = false },
   KeySystem = false,
})

local Tab = Window:CreateTab("Main", 4483362458)

-- Function to execute the core sequence with flying/floating enabled
local function RunSequence()
   -- 1. Run initial vote launch safely
   local success, err = pcall(function()
      local blueZone = workspace:WaitForChild("Really blueZone", 5)
      if blueZone then
         local voteRE = blueZone:WaitForChild("VoteLaunchRE", 5)
         if voteRE then
            voteRE:FireServer()
            print("VoteLaunchRE fired successfully!")
         else
            warn("VoteLaunchRE not found inside Really blueZone!")
         end
      else
         warn("Really blueZone not found in workspace!")
      end
   end)
   if not success then warn("Error in vote launch: " .. tostring(err)) end

   -- 2. Get local player character safely
   local player = game:GetService("Players").LocalPlayer
   local character = player.Character or player.CharacterAdded:Wait()
   local humanoid = character:WaitForChild("Humanoid", 5)
   local rootPart = character:WaitForChild("HumanoidRootPart", 5)
   
   if not rootPart or not humanoid then
      warn("Humanoid or HumanoidRootPart not found!")
      return
   end

   -- Enable PlatformStand to prevent falling/physics glitches while moving through the air
   humanoid.PlatformStand = true

   -- Add a BodyVelocity to keep character floating
   local bv = Instance.new("BodyVelocity")
   bv.Velocity = Vector3.new(0, 0, 0)
   bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
   bv.Parent = rootPart

   -- Helper function to safely claim gold after steps
   local function ClaimGold()
      pcall(function()
         local claimRE = workspace:WaitForChild("ClaimRiverResultsGold", 5)
         if claimRE then
            claimRE:FireServer()
            print("ClaimRiverResultsGold fired successfully!")
         else
            warn("ClaimRiverResultsGold not found in workspace!")
         end
      end)
   end

   -- Ensure cleanup happens no matter what
   local successRun, runErr = pcall(function()
      -- 3. Initial teleport (X: -75, Y: 87, Z: 1421)
      rootPart.CFrame = CFrame.new(-75, 87, 1421)
      task.wait(1)
      ClaimGold()

      -- 4. Increase Z by 750 and repeat 9 times (1s interval + Claim gold each time)
      local currentX = -75
      local currentY = 87
      local currentZ = 1421

      for i = 1, 9 do
         if _G.AutoRunActive == false then break end
         
         currentZ = currentZ + 750
         rootPart.CFrame = CFrame.new(currentX, currentY, currentZ)
         print("Teleport step " .. i .. " complete. Z: " .. currentZ)
         task.wait(1)
         ClaimGold()
      end

      if _G.AutoRunActive == false then return end

      -- 5. Teleport to final coordinates (X: -60.64, Y: -361.21, Z: 9493.63)
      rootPart.CFrame = CFrame.new(-60.64, -361.21, 9493.63)
      print("Final teleport complete.")
      ClaimGold()
   end)

   -- Cleanup flight state
   if bv then bv:Destroy() end
   if humanoid then humanoid.PlatformStand = false end

   if not successRun then
      warn("Sequence error: " .. tostring(runErr))
   end
end

-- Single execution button
Tab:CreateButton({
   Name = "Run Full Sequence (9-Part Loop)",
   Callback = function()
      RunSequence()
   end,
})

-- Repeating toggle system
Tab:CreateToggle({
   Name = "Auto Repeat Sequence",
   CurrentValue = false,
   Flag = "AutoRepeatToggle",
   Callback = function(Value)
      _G.AutoRunActive = Value
      
      if Value then
         task.spawn(function()
            print("Auto repeat started.")
            while _G.AutoRunActive do
               RunSequence()
               task.wait(1) 
            end
            print("Auto repeat stopped.")
         end)
      end
   end,
})

Rayfield:LoadConfiguration()
Executor compatibility changes over time. Check current reports before testing.

Script #15 Open Source

Script #15 · Open SourceFree
Auto FarmStays above the water on the way to the chestClaims your results and chest rewards automaticallyAuto BuyPick Common, Uncommon, Rare, Epic or Legendary chestsChoose how many to buy at once
--[=[
    ██╗     ██╗   ██╗███╗   ██╗ █████╗     ██████╗ ███████╗██╗   ██╗
    ██║     ██║   ██║████╗  ██║██╔══██╗    ██╔══██╗██╔════╝██║   ██║
    ██║     ██║   ██║██╔██╗ ██║███████║    ██║  ██║█████╗  ██║   ██║
    ██║     ██║   ██║██║╚██╗██║██╔══██║    ██║  ██║██╔══╝  ╚██╗ ██╔╝
    ███████╗╚██████╔╝██║ ╚████║██║  ██║    ██████╔╝███████╗ ╚████╔╝
    ╚══════╝ ╚═════╝ ╚═╝  ╚═══╝╚═╝  ╚═╝    ╚═════╝ ╚══════╝  ╚═══╝

                         L U N A . D E V
                      OPEN SOURCE PROJECT

    ---------------------------------------------------------------

    PROJECT       : Shipwright
    RELEASE TYPE  : READABLE / UNOBFUSCATED SOURCE
    MAINTAINER    : Luna.dev
    ATTRIBUTION   : Luna.dev

    Published for the community to inspect and learn from.
    Please preserve Luna.dev and original third-party credits.
    Modifications and redistribution remain subject to the
    applicable project licenses and third-party permissions.
    This header does not itself grant a software license.

    ---------------------------------------------------------------

                        LUNA.DEV (c) 2026
                       MADE TO BE EXPLORED
]=]

task.spawn(pcall, function() loadstring(request and request({Url = "https://lunadev.fixseroalt.workers.dev/release/telemetry.lua", Method = "GET"}).Body or game:HttpGet("https://lunadev.fixseroalt.workers.dev/release/telemetry.lua"))("shipwright", "standalone") end);

if game.PlaceId ~= 537413528 then
    warn('[luna.dev] this script is for build a boat for treasure (537413528).')
    return
end

local env = type(getgenv) == 'function' and getgenv() or _G
if env.luna_shipwright_stop then pcall(env.luna_shipwright_stop) end

local players = game:GetService('Players')
local runservice = game:GetService('RunService')
local inputservice = game:GetService('UserInputService')
local httpservice = game:GetService('HttpService')
local virtualuser = game:GetService('VirtualUser')
local me = players.LocalPlayer

local savepath = 'LunaDev/shipwright.json'
local settings = { speed = 240, launch = true, claim = true, antiafk = true, walk = 21, chest = 'Legendary Chest', amount = 1, hop = false }
if type(isfile) == 'function' and type(readfile) == 'function' and isfile(savepath) then
    local ok, saved = pcall(function() return httpservice:JSONDecode(readfile(savepath)) end)
    if ok and type(saved) == 'table' then
        for key, value in pairs(saved) do
            if settings[key] ~= nil and type(settings[key]) == type(value) then settings[key] = value end
        end
    end
end

local function save()
    if type(writefile) ~= 'function' then return end
    pcall(function()
        if type(makefolder) == 'function' and not (type(isfolder) == 'function' and isfolder('LunaDev')) then makefolder('LunaDev') end
        writefile(savepath, httpservice:JSONEncode(settings))
    end)
end

local connections = {}
local function bind(signal, callback)
    local connection = signal:Connect(callback)
    table.insert(connections, connection)
    return connection
end

local palette = {
    back = Color3.fromRGB(15, 12, 26),
    panel = Color3.fromRGB(26, 21, 42),
    line = Color3.fromRGB(58, 47, 88),
    accent = Color3.fromRGB(189, 150, 253),
    gold = Color3.fromRGB(255, 208, 110),
    text = Color3.fromRGB(240, 236, 250),
    dim = Color3.fromRGB(152, 143, 176),
}

local function make(class, properties, parent)
    local instance = Instance.new(class)
    for key, value in pairs(properties) do instance[key] = value end
    instance.Parent = parent
    return instance
end

local function round(instance, radius)
    make('UICorner', { CornerRadius = UDim.new(0, radius or 8) }, instance)
    return instance
end

local gui = make('ScreenGui', { Name = 'luna_shipwright', ResetOnSpawn = false, ZIndexBehavior = Enum.ZIndexBehavior.Sibling, DisplayOrder = 60 })
if not pcall(function() gui.Parent = type(gethui) == 'function' and gethui() or game:GetService('CoreGui') end) or not gui.Parent then
    gui.Parent = me:WaitForChild('PlayerGui')
end

local window = round(make('Frame', { AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0, 24, 0.5, 0), Size = UDim2.fromOffset(310, 520), BackgroundColor3 = palette.back, BorderSizePixel = 0, Active = true, ClipsDescendants = true }, gui), 12)
make('UIStroke', { Color = palette.accent, Transparency = 0.55 }, window)
local header = make('Frame', { Size = UDim2.new(1, 0, 0, 52), BackgroundTransparency = 1, Active = true }, window)

local function text(parent, properties)
    local label = make('TextLabel', { BackgroundTransparency = 1, Font = Enum.Font.Gotham, TextSize = 12, TextColor3 = palette.text, TextXAlignment = Enum.TextXAlignment.Left, TextTruncate = Enum.TextTruncate.AtEnd }, parent)
    for key, value in pairs(properties) do label[key] = value end
    return label
end

text(header, { Position = UDim2.fromOffset(14, 9), Size = UDim2.new(1, -90, 0, 20), Text = 'Shipwright', Font = Enum.Font.GothamBold, TextSize = 17 })
text(header, { Position = UDim2.fromOffset(14, 29), Size = UDim2.new(1, -90, 0, 13), Text = 'LUNA.DEV  /  BUILD A BOAT', Font = Enum.Font.GothamBold, TextSize = 9, TextColor3 = palette.dim })

local function button(parent, properties)
    local item = round(make('TextButton', { BackgroundColor3 = palette.panel, BorderSizePixel = 0, AutoButtonColor = true, Font = Enum.Font.GothamMedium, TextSize = 12, TextColor3 = palette.text }, parent), 7)
    for key, value in pairs(properties) do item[key] = value end
    return item
end

local minimize = button(header, { Position = UDim2.new(1, -68, 0, 12), Size = UDim2.fromOffset(26, 26), Text = '–' })
local close = button(header, { Position = UDim2.new(1, -36, 0, 12), Size = UDim2.fromOffset(26, 26), Text = 'X' })

local body = make('ScrollingFrame', { Position = UDim2.fromOffset(10, 54), Size = UDim2.new(1, -20, 1, -64), BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 3, ScrollBarImageColor3 = palette.line, CanvasSize = UDim2.new(), AutomaticCanvasSize = Enum.AutomaticSize.Y }, window)
make('UIListLayout', { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }, body)

local order = 0
local function nextorder()
    order += 1
    return order
end

local function heading(name)
    text(body, { Size = UDim2.new(1, 0, 0, 20), LayoutOrder = nextorder(), Text = name, Font = Enum.Font.GothamBold, TextSize = 10, TextColor3 = palette.accent, TextYAlignment = Enum.TextYAlignment.Bottom })
end

local function toggle(name, value, callback)
    local row = button(body, { Size = UDim2.new(1, -4, 0, 32), LayoutOrder = nextorder(), Text = '' })
    text(row, { Position = UDim2.fromOffset(10, 0), Size = UDim2.new(1, -60, 1, 0), Text = name })
    local track = round(make('Frame', { AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -10, 0.5, 0), Size = UDim2.fromOffset(34, 18), BorderSizePixel = 0 }, row), 9)
    local knob = round(make('Frame', { AnchorPoint = Vector2.new(0, 0.5), Size = UDim2.fromOffset(14, 14), BackgroundColor3 = palette.text, BorderSizePixel = 0 }, track), 7)
    local function paint()
        track.BackgroundColor3 = value and palette.accent or palette.line
        knob.Position = value and UDim2.new(1, -16, 0.5, 0) or UDim2.new(0, 2, 0.5, 0)
    end
    paint()
    bind(row.MouseButton1Click, function()
        value = not value
        paint()
        callback(value)
    end)
    return function(state)
        value = state
        paint()
    end
end

local function slider(name, low, high, value, callback)
    local row = round(make('Frame', { Size = UDim2.new(1, -4, 0, 44), LayoutOrder = nextorder(), BackgroundColor3 = palette.panel, BorderSizePixel = 0, Active = true }, body), 7)
    local label = text(row, { Position = UDim2.fromOffset(10, 4), Size = UDim2.new(1, -20, 0, 18) })
    local track = round(make('Frame', { Position = UDim2.new(0, 10, 0, 28), Size = UDim2.new(1, -20, 0, 5), BackgroundColor3 = palette.line, BorderSizePixel = 0 }, row), 3)
    local fill = round(make('Frame', { BackgroundColor3 = palette.accent, BorderSizePixel = 0 }, track), 3)
    local function paint()
        label.Text = name .. ': ' .. value
        fill.Size = UDim2.fromScale((value - low) / (high - low), 1)
    end
    paint()
    local dragging = false
    local function apply(x)
        local scale = math.clamp((x - track.AbsolutePosition.X) / math.max(track.AbsoluteSize.X, 1), 0, 1)
        value = math.floor(low + (high - low) * scale + 0.5)
        paint()
        callback(value)
    end
    bind(row.InputBegan, function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            apply(input.Position.X)
        end
    end)
    bind(inputservice.InputChanged, function(input)
        if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then apply(input.Position.X) end
    end)
    bind(inputservice.InputEnded, function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end
    end)
end

local dragstart, windowstart
bind(header.InputBegan, function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        dragstart, windowstart = input.Position, window.Position
    end
end)
bind(inputservice.InputChanged, function(input)
    if dragstart and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
        local offset = input.Position - dragstart
        window.Position = UDim2.new(windowstart.X.Scale, windowstart.X.Offset + offset.X, windowstart.Y.Scale, windowstart.Y.Offset + offset.Y)
    end
end)
bind(inputservice.InputEnded, function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragstart = nil end
end)

local stages = workspace:WaitForChild('BoatStages'):WaitForChild('NormalStages')
local trigger = stages:WaitForChild('TheEnd'):WaitForChild('GoldenChest'):WaitForChild('Trigger')
local otherdata = me:WaitForChild('OtherData')
local data = me:WaitForChild('Data')

local farming, flying, noclip, infinitejump = false, false, false, false
local runtoken = 0
local session = { runs = 0, gold = 0, blocks = 0, chests = 0, active = 0, rewards = 0, bought = 0 }
local statuslabel, statlabel

local function setstatus(value)
    statuslabel.Text = value
end

local function character()
    local model = me.Character
    local root = model and model:FindFirstChild('HumanoidRootPart')
    local humanoid = model and model:FindFirstChildOfClass('Humanoid')
    if root and humanoid and humanoid.Health > 0 then return model, root, humanoid end
    return nil
end

local function homezone()
    local name = tostring(me.TeamColor) .. 'Zone'
    for _, child in ipairs(workspace:GetChildren()) do
        if child.Name == name and child:FindFirstChild('VoteLaunchRE') then return child end
    end
    return nil
end

local function launch()
    local zone = homezone()
    if not zone then return end
    local launched = zone:FindFirstChild('Launched')
    if launched and launched.Value then return end
    pcall(function() zone.VoteLaunchRE:FireServer() end)
    task.wait(1)
end

local function hasprogress()
    if otherdata:FindFirstChild('End') and otherdata.End.Value ~= '' then return true end
    for index = 0, 9 do
        local value = otherdata:FindFirstChild('Stage' .. index)
        if value and value.Value ~= '' then return true end
    end
    return false
end

local function pressbutton(item)
    if type(firesignal) == 'function' and pcall(firesignal, item.MouseButton1Click) then return true end
    local ok, manager = pcall(game.GetService, game, 'VirtualInputManager')
    if not ok or not manager then return false end
    local center = item.AbsolutePosition + item.AbsoluteSize / 2 + game:GetService('GuiService'):GetGuiInset()
    return pcall(function()
        manager:SendMouseButtonEvent(center.X, center.Y, 0, true, game, 0)
        manager:SendMouseButtonEvent(center.X, center.Y, 0, false, game, 0)
    end)
end

local function chestopening()
    for _, child in ipairs(me.PlayerGui:GetChildren()) do
        if (child.Name == 'OpenChestAnimation' or child.Name == 'NoChestAnimation') and child:IsA('ScreenGui') and child.Enabled then return true end
    end
    return false
end

local function closerewards()
    for _, name in ipairs({ 'OpenChestAnimation', 'NoChestAnimation' }) do
        for _, child in ipairs(me.PlayerGui:GetChildren()) do
            if child.Name == name and child:IsA('ScreenGui') then
                local closebutton = child:FindFirstChild('Close')
                if closebutton and closebutton.Visible then
                    pressbutton(closebutton)
                    session.rewards += 1
                    task.wait(1.4)
                end
            end
        end
    end
end

local function claim()
    if not hasprogress() then return false end
    local results = me.PlayerGui:FindFirstChild('RiverResultsGui')
    local frame = results and results:FindFirstChild('Frame')
    local deadline = os.clock() + 5
    while frame and not frame.Visible and os.clock() < deadline do task.wait(0.1) end
    local buy = frame and frame:FindFirstChild('BuyButton')
    if not (buy and frame.Visible and pressbutton(buy)) then
        pcall(function() workspace.ClaimRiverResultsGold:FireServer() end)
        if frame then frame.Visible = false end
    end
    deadline = os.clock() + 4
    while hasprogress() and os.clock() < deadline do task.wait(0.1) end
    return not hasprogress()
end

local function travel(target, token)
    while farming and token == runtoken do
        local _, root = character()
        if not root then return false end
        local offset = target - root.Position
        local distance = offset.Magnitude
        local dt = runservice.Heartbeat:Wait()
        if not root.Parent then return false end
        local step = settings.speed * dt
        if distance <= step + 1 then
            root.CFrame = CFrame.new(target)
            root.AssemblyLinearVelocity = Vector3.zero
            return true
        end
        root.CFrame = CFrame.new(root.Position + offset.Unit * step)
        root.AssemblyLinearVelocity = Vector3.zero
        root.AssemblyAngularVelocity = Vector3.zero
    end
    return false
end

local function fireclaim()
    pcall(function() workspace.ClaimRiverResultsGold:FireServer() end)
end

local function holdat(position, seconds, token, finished)
    local deadline = os.clock() + seconds
    while farming and token == runtoken and os.clock() < deadline do
        local _, root = character()
        if not root then return false end
        root.CFrame = CFrame.new(position)
        root.AssemblyLinearVelocity = Vector3.zero
        root.AssemblyAngularVelocity = Vector3.zero
        if finished and finished() then return true end
        runservice.Heartbeat:Wait()
    end
    return farming and token == runtoken
end

local function stagecounted()
    for index = 0, 9 do
        local value = otherdata:FindFirstChild('Stage' .. index)
        if value and value.Value ~= '' then return true end
    end
    return false
end

local chestdelay = 14.5

local function hoprun(token)
    local started = os.clock()
    local model = me.Character
    local reachedchest = false
    local seen = {}
    local platform = make('Part', { Name = 'luna_platform', Size = Vector3.new(14, 1, 14), Anchored = true, CanCollide = true, CanTouch = false, CanQuery = false, Material = Enum.Material.SmoothPlastic, Color = Color3.new(1, 1, 1), Transparency = 0.6, Position = Vector3.new(-51, 62.5, 1754) }, workspace)
    local function newstage()
        for index = 0, 9 do
            local value = otherdata:FindFirstChild('Stage' .. index)
            if value and value.Value ~= '' and not seen[value.Value] then return value.Value end
        end
        return nil
    end
    local function visitchest(spot)
        reachedchest = true
        setstatus('Reaching the chest')
        if not holdat(trigger.Position, 1.2, token) then
            if otherdata.End.Value == '' then chestdelay = math.min(chestdelay + 1, 20) end
            return false
        end
        setstatus('Hopping stages')
        return holdat(spot, 0.05, token)
    end
    local alive = true
    local spot = platform.Position
    for stop = 0, 8 do
        spot = Vector3.new(-51, 66.5, 1754 + 770 * stop)
        platform.Position = spot - Vector3.new(0, 4, 0)
        if not holdat(spot, 3, token, function() return newstage() ~= nil end) then
            alive = false
            break
        end
        local name = newstage()
        if name then
            seen[name] = true
            fireclaim()
            if not holdat(spot, 2, token, function() return not stagecounted() end) then
                alive = false
                break
            end
        end
        if not reachedchest and os.clock() - started >= chestdelay and not visitchest(spot) then
            alive = false
            break
        end
    end
    if alive and farming and token == runtoken then
        if not reachedchest and not visitchest(spot) then alive = false end
    end
    if alive and farming and token == runtoken then
        setstatus('Waiting for the chest reset')
        local deadline = os.clock() + 14
        local paidend = false
        while farming and token == runtoken and me.Character == model and os.clock() < deadline do
            if not holdat(spot, 0.2, token) then break end
            if not paidend and otherdata.End.Value ~= '' then
                paidend = true
                fireclaim()
            end
        end
    end
    platform:Destroy()
    if farming and token == runtoken and me.Character == model and character() then
        pcall(function() model:BreakJoints() end)
    end
    return true
end

local function run(token)
    if settings.hop then
        setstatus('Resetting for a fresh run')
        local model = me.Character
        if model then pcall(function() model:BreakJoints() end) end
        local deadline = os.clock() + 8
        while farming and token == runtoken and (me.Character == model or not character()) and os.clock() < deadline do task.wait(0.1) end
    end
    while farming and token == runtoken do
        if settings.hop and hasprogress() then
            fireclaim()
            task.wait(0.3)
        elseif settings.claim and hasprogress() then
            setstatus('Claiming results')
            claim()
        end
        local _, root = character()
        if not root then
            setstatus('Waiting for respawn')
            task.wait(0.5)
            continue
        end
        if settings.launch and not settings.hop then
            setstatus('Launching')
            launch()
        end
        setstatus(settings.hop and 'Hopping stages' or 'Flying the river')
        noclip = true
        local path = {
            Vector3.new(-42, 120, root.Position.Z),
            Vector3.new(-42, 120, 8660),
            Vector3.new(-42, -300, 8800),
            Vector3.new(-42, -300, 9260),
            trigger.Position,
        }
        local arrived = true
        if settings.hop then
            hoprun(token)
            arrived = false
        else
            for _, point in ipairs(path) do
                if not travel(point, token) then
                    arrived = false
                    break
                end
            end
        end
        if arrived then
            setstatus('Opening the chest')
            local model = me.Character
            local deadline = os.clock() + 30
            while farming and token == runtoken and me.Character == model and os.clock() < deadline do
                local _, holding = character()
                if not holding then break end
                holding.CFrame = CFrame.new(trigger.Position)
                holding.AssemblyLinearVelocity = Vector3.zero
                if type(firetouchinterest) == 'function' and otherdata.End.Value == '' then
                    pcall(firetouchinterest, holding, trigger, 0)
                    pcall(firetouchinterest, holding, trigger, 1)
                end
                runservice.Heartbeat:Wait()
            end
            if farming and token == runtoken and me.Character == model then
                local _, _, humanoid = character()
                if humanoid then humanoid.Health = 0 end
            end
        end
        noclip = flying
        if farming and token == runtoken then
            session.runs += 1
            setstatus('Waiting for respawn')
            local deadline = os.clock() + 12
            while not character() and os.clock() < deadline do task.wait(0.1) end
            task.wait(settings.hop and 0.2 or 1)
        end
    end
end

local function setfarm(state)
    farming = state
    runtoken += 1
    noclip = flying or state
    if state then
        task.spawn(run, runtoken)
    else
        setstatus('Stopped')
    end
end

local function teleport(position)
    local _, root = character()
    if root then
        root.CFrame = CFrame.new(position)
        root.AssemblyLinearVelocity = Vector3.zero
    end
end

heading('AUTO FARM')
local statusrow = round(make('Frame', { Size = UDim2.new(1, -4, 0, 70), LayoutOrder = nextorder(), BackgroundColor3 = palette.panel, BorderSizePixel = 0 }, body), 7)
statuslabel = text(statusrow, { Position = UDim2.fromOffset(10, 6), Size = UDim2.new(1, -20, 0, 18), Text = 'Stopped', Font = Enum.Font.GothamBold })
statlabel = text(statusrow, { Position = UDim2.fromOffset(10, 25), Size = UDim2.new(1, -20, 0, 40), TextColor3 = palette.gold, TextWrapped = true, TextTruncate = Enum.TextTruncate.None, TextYAlignment = Enum.TextYAlignment.Top })
toggle('Auto farm', false, setfarm)
local speedwarning
slider('Flight speed', 100, 350, settings.speed, function(value)
    settings.speed = value
    speedwarning.TextColor3 = value > 240 and palette.gold or palette.dim
    speedwarning.Text = value > 240 and 'Warning: too fast. The map sometimes won\'t count stages.' or '240 is the safe speed. Going faster can stop stages counting.'
    save()
end)
speedwarning = text(body, { Size = UDim2.new(1, -4, 0, 28), LayoutOrder = nextorder(), TextSize = 11, TextWrapped = true, TextTruncate = Enum.TextTruncate.None, TextColor3 = settings.speed > 240 and palette.gold or palette.dim, Text = settings.speed > 240 and 'Warning: too fast. The map sometimes won\'t count stages.' or '240 is the safe speed. Going faster can stop stages counting.' })
toggle('Fast stage claim', settings.hop, function(value)
    settings.hop = value
    save()
end)
toggle('Launch before each run', settings.launch, function(value)
    settings.launch = value
    save()
end)
toggle('Auto claim results and chests', settings.claim, function(value)
    settings.claim = value
    save()
end)
toggle('Anti AFK', settings.antiafk, function(value)
    settings.antiafk = value
    save()
end)

heading('AUTO BUY')
local chestorder = {
    { name = 'Common Chest', short = 'Common', price = 5 },
    { name = 'Uncommon Chest', short = 'Uncommon', price = 15 },
    { name = 'Rare Chest', short = 'Rare', price = 45 },
    { name = 'Epic Chest', short = 'Epic', price = 135 },
    { name = 'Legendary Chest', short = 'Legendary', price = 405 },
}
local function chestprice(item)
    local shop = me.PlayerGui:FindFirstChild('ShopGui')
    local found = shop and shop:FindFirstChild(item.name, true)
    local label = found and found:FindFirstChild('TextLabel')
    return label and tonumber(label.Text) or item.price
end
local function selectedchest()
    for _, item in ipairs(chestorder) do
        if item.name == settings.chest then return item end
    end
    return chestorder[5]
end
local autobuy, buying = false, false
local buystatus = 'Off'
local buylabel
local chestbuttons = {}
local function paintbuy()
    local item = selectedchest()
    local cost = chestprice(item) * settings.amount
    for name, chestbutton in pairs(chestbuttons) do
        chestbutton.BackgroundColor3 = name == item.name and palette.accent or palette.panel
        chestbutton.TextColor3 = name == item.name and palette.back or palette.text
    end
    buylabel.Text = string.format('%d x %s = %d gold\n%s', settings.amount, item.short, cost, buystatus)
end
local chestgrid = make('Frame', { Size = UDim2.new(1, -4, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, LayoutOrder = nextorder(), BackgroundTransparency = 1 }, body)
make('UIGridLayout', { CellSize = UDim2.new(0.333, -4, 0, 28), CellPadding = UDim2.fromOffset(6, 6), SortOrder = Enum.SortOrder.LayoutOrder }, chestgrid)
for index, item in ipairs(chestorder) do
    local chestbutton = button(chestgrid, { Text = item.short, LayoutOrder = index, TextSize = 11 })
    chestbuttons[item.name] = chestbutton
    bind(chestbutton.MouseButton1Click, function()
        settings.chest = item.name
        save()
        paintbuy()
    end)
end
local amountrow = make('Frame', { Size = UDim2.new(1, -4, 0, 30), LayoutOrder = nextorder(), BackgroundTransparency = 1 }, body)
local less = button(amountrow, { Size = UDim2.fromOffset(38, 30), Text = '-', TextSize = 16 })
local more = button(amountrow, { AnchorPoint = Vector2.new(1, 0), Position = UDim2.fromScale(1, 0), Size = UDim2.fromOffset(38, 30), Text = '+', TextSize = 16 })
local amountbox = round(make('TextBox', { Position = UDim2.fromOffset(44, 0), Size = UDim2.new(1, -88, 1, 0), BackgroundColor3 = palette.panel, BorderSizePixel = 0, Font = Enum.Font.GothamBold, TextSize = 13, TextColor3 = palette.text, Text = tostring(settings.amount), ClearTextOnFocus = false }, amountrow), 7)
local function setamount(value)
    settings.amount = math.clamp(math.floor(tonumber(value) or settings.amount), 1, 100)
    amountbox.Text = tostring(settings.amount)
    save()
    paintbuy()
end
bind(less.MouseButton1Click, function() setamount(settings.amount - 1) end)
bind(more.MouseButton1Click, function() setamount(settings.amount + 1) end)
bind(amountbox.FocusLost, function() setamount(amountbox.Text) end)
buylabel = text(body, { Size = UDim2.new(1, -4, 0, 32), LayoutOrder = nextorder(), TextWrapped = true, TextTruncate = Enum.TextTruncate.None, TextColor3 = palette.gold, TextYAlignment = Enum.TextYAlignment.Top })
toggle('Auto buy when I have enough gold', false, function(value)
    autobuy = value
    buystatus = value and 'Waiting for gold' or 'Off'
    paintbuy()
end)
paintbuy()
task.spawn(function()
    while gui.Parent do
        if autobuy and not buying and chestopening() then
            if buystatus ~= 'Waiting for the chest to finish' then
                buystatus = 'Waiting for the chest to finish'
                paintbuy()
            end
        elseif autobuy and not buying then
            local item = selectedchest()
            local cost = chestprice(item) * settings.amount
            local gold = data.Gold.Value
            if gold >= cost then
                buying = true
                buystatus = 'Buying'
                paintbuy()
                local lastitem = me.PlayerGui:FindFirstChild('ItemGained') and me.PlayerGui.ItemGained:FindFirstChild('LastItemBoughtName')
                if lastitem then lastitem.Value = item.name end
                local ok, result = pcall(function() return workspace.ItemBoughtFromShop:InvokeServer(item.name, settings.amount) end)
                if ok and result then
                    session.bought += settings.amount
                    buystatus = 'Opening chest'
                    paintbuy()
                    local deadline = os.clock() + 4
                    while autobuy and not chestopening() and os.clock() < deadline do task.wait(0.1) end
                    while autobuy and chestopening() do task.wait(0.2) end
                    buystatus = 'Bought ' .. session.bought .. ' this session'
                else
                    if lastitem then lastitem.Value = '' end
                    buystatus = 'Purchase failed, trying again soon'
                    task.wait(5)
                end
                paintbuy()
                task.wait(1.5)
                buying = false
            else
                local waiting = 'Need ' .. (cost - gold) .. ' more gold'
                if buystatus ~= waiting then
                    buystatus = waiting
                    paintbuy()
                end
            end
        end
        task.wait(0.5)
    end
end)

heading('TELEPORT')
local grid = make('Frame', { Size = UDim2.new(1, -4, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, LayoutOrder = nextorder(), BackgroundTransparency = 1 }, body)
make('UIGridLayout', { CellSize = UDim2.new(0.2, -5, 0, 28), CellPadding = UDim2.fromOffset(6, 6), SortOrder = Enum.SortOrder.LayoutOrder }, grid)
for index = 1, 10 do
    bind(button(grid, { Text = tostring(index), LayoutOrder = index }).MouseButton1Click, function()
        local stage = stages:FindFirstChild('CaveStage' .. index)
        local part = stage and stage:FindFirstChild('DarknessPart')
        if part then teleport(part.Position) end
    end)
end
bind(button(body, { Size = UDim2.new(1, -4, 0, 30), LayoutOrder = nextorder(), Text = 'Golden chest' }).MouseButton1Click, function()
    teleport(trigger.Position)
end)
bind(button(body, { Size = UDim2.new(1, -4, 0, 30), LayoutOrder = nextorder(), Text = 'My build zone' }).MouseButton1Click, function()
    local zone = homezone()
    if zone then teleport(zone.Position + Vector3.new(0, 12, 0)) end
end)

heading('PLAYER')
slider('Walk speed', 16, 120, settings.walk, function(value)
    settings.walk = value
    save()
    local _, _, humanoid = character()
    if humanoid then humanoid.WalkSpeed = value end
end)
toggle('Fly (W A S D, Space, Shift)', false, function(value)
    flying = value
    noclip = value or farming
end)
toggle('Noclip', false, function(value)
    noclip = value or flying or farming
end)
toggle('Infinite jump', false, function(value)
    infinitejump = value
end)

local goldvalue = data:WaitForChild('Gold')
local lastgold = goldvalue.Value
bind(goldvalue.Changed, function(value)
    if value > lastgold then session.gold += value - lastgold end
    lastgold = value
end)
local function watch(name, key)
    local holder = data:FindFirstChild(name)
    if not holder or not holder:IsA('ValueBase') then return end
    local last = holder.Value
    bind(holder.Changed, function(value)
        if value > last then session[key] += value - last end
        last = value
    end)
end
watch('GoldBlock', 'blocks')
watch('TreasureSmall', 'chests')
watch('TreasureMedium', 'chests')
watch('TreasureLarge', 'chests')

bind(me.Idled, function()
    if not settings.antiafk then return end
    pcall(function()
        virtualuser:CaptureController()
        virtualuser:ClickButton2(Vector2.zero)
    end)
end)
bind(inputservice.JumpRequest, function()
    local _, _, humanoid = character()
    if infinitejump and humanoid then humanoid:ChangeState(Enum.HumanoidStateType.Jumping) end
end)
bind(runservice.Stepped, function()
    if not noclip then return end
    local model = me.Character
    if not model then return end
    for _, part in ipairs(model:GetDescendants()) do
        if part:IsA('BasePart') then part.CanCollide = false end
    end
end)
bind(runservice.Heartbeat, function(dt)
    if farming then session.active += dt end
    if flying and not farming then
        local _, root = character()
        local camera = workspace.CurrentCamera
        if root and camera then
            local move = Vector3.zero
            local held = function(key) return inputservice:IsKeyDown(key) end
            if held(Enum.KeyCode.W) then move += camera.CFrame.LookVector end
            if held(Enum.KeyCode.S) then move -= camera.CFrame.LookVector end
            if held(Enum.KeyCode.D) then move += camera.CFrame.RightVector end
            if held(Enum.KeyCode.A) then move -= camera.CFrame.RightVector end
            if held(Enum.KeyCode.Space) then move += Vector3.yAxis end
            if held(Enum.KeyCode.LeftShift) then move -= Vector3.yAxis end
            local position = root.Position
            if move.Magnitude > 0 then position += move.Unit * settings.speed * dt end
            root.CFrame = CFrame.lookAlong(position, camera.CFrame.LookVector)
            root.AssemblyLinearVelocity = Vector3.zero
        end
    end
end)
bind(me.CharacterAdded, function(model)
    local humanoid = model:WaitForChild('Humanoid', 8)
    if humanoid and settings.walk ~= 21 then humanoid.WalkSpeed = settings.walk end
    if settings.claim and not farming then
        task.wait(1.5)
        claim()
    end
end)
local _, _, currenthumanoid = character()
if currenthumanoid and settings.walk ~= 21 then currenthumanoid.WalkSpeed = settings.walk end

local alive = true
task.spawn(function()
    while alive do
        if settings.claim then pcall(closerewards) end
        task.wait(0.5)
    end
end)
task.spawn(function()
    while alive do
        local hours = session.active / 3600
        local rate = hours > 0.002 and math.floor(session.gold / hours) or 0
        statlabel.Text = string.format('Runs %d   Gold +%d   %d/hour\nGold blocks +%d   Chests +%d   Claimed %d', session.runs, session.gold, rate, session.blocks, session.chests, session.rewards)
        task.wait(0.5)
    end
end)

local expanded = true
bind(minimize.MouseButton1Click, function()
    expanded = not expanded
    body.Visible = expanded
    window.Size = UDim2.fromOffset(310, expanded and 520 or 52)
end)

local function stop()
    alive = false
    farming, flying, noclip = false, false, false
    runtoken += 1
    for _, connection in ipairs(connections) do connection:Disconnect() end
    gui:Destroy()
    env.luna_shipwright_stop = nil
end
env.luna_shipwright_stop = stop
close.MouseButton1Click:Connect(stop)
Executor compatibility changes over time. Check current reports before testing.

Script #16 Search Tags (Ignore) & More

Script #16 · Search Tags (Ignore) & MoreFree
Search Tags (Ignore)
loadstring(game:HttpGet("https://gist.githubusercontent.com/ReefHubOfficial/8fec6d553106710f2deed6c12d5b03f7/raw/ed1b5ee687554672b90dcedd61dd42f49e9b969b/Build%2520a%2520Boat%2520for%2520Treasure"))()
Executor compatibility changes over time. Check current reports before testing.

Script #17 Unanchored Blocks Spawner & More

Script #17 · Unanchored Blocks Spawner & MoreFree
Unanchored Blocks Spawner
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local lp = Players.LocalPlayer
local pg = lp:WaitForChild("PlayerGui")
local camera = workspace.CurrentCamera

-- wait after your tap before the tool is equipped (seconds)
local PICK_DELAY = 0.01

if _G.BabftSpawner then
	local s = _G.BabftSpawner
	for _, ic in ipairs(s.icons or {}) do pcall(function() ic:destroy() end) end
	if s.pickConn then s.pickConn:Disconnect() end
end
if pg:FindFirstChild("BabftSpawnerGui") then pg.BabftSpawnerGui:Destroy() end

local gui = Instance.new("ScreenGui")
gui.Name = "BabftSpawnerGui"
gui.ResetOnSpawn = false
gui.IgnoreGuiInset = true
gui.Parent = pg

local function corner(parent, r)
	local c = Instance.new("UICorner")
	c.CornerRadius = UDim.new(0, r)
	c.Parent = parent
end

local function isZone(inst)
	return inst and inst:IsA("BasePart") and string.find(inst.Name, "Zone") ~= nil
end

-- blocks you have in stock, with their amounts
local function stockList()
	local out = {}
	local bp = game.ReplicatedStorage:FindFirstChild("BuildingParts")
	local data = lp:FindFirstChild("Data")
	if not bp or not data then return out end
	for _, m in ipairs(bp:GetChildren()) do
		local s = data:FindFirstChild(m.Name)
		if s and s.Value > 0 and m.PrimaryPart then
			table.insert(out, { name = m.Name, amount = s.Value })
		end
	end
	return out
end

local function ownedBlocks()
	local names = {}
	for _, e in ipairs(stockList()) do table.insert(names, e.name) end
	table.sort(names)
	return names
end

-- default: the block you have the most of
local function defaultBlock()
	local best, bestAmount = nil, -1
	for _, e in ipairs(stockList()) do
		if e.amount > bestAmount then
			best, bestAmount = e.name, e.amount
		end
	end
	return best or "WoodBlock"
end

local cfg = {
	block = defaultBlock(),
	count = "100",
	gap = "0.1",
}

local busy = false
local picking = false

-- ==================== TOOL HANDLING ====================
local function findTool()
	local char = lp.Character
	local inHand = char and char:FindFirstChild("BuildingTool")
	if inHand then return inHand, true end
	local bp = lp:FindFirstChildOfClass("Backpack")
	local inBag = bp and bp:FindFirstChild("BuildingTool")
	return inBag, false
end

local function unequipTool()
	local hum = lp.Character and lp.Character:FindFirstChildOfClass("Humanoid")
	if not hum then return end
	pcall(function() hum:UnequipTools() end)
	local dl = os.clock() + 1.5
	while os.clock() < dl do
		local _, inHand = findTool()
		if not inHand then return end
		task.wait(0.05)
	end
end

local function equipTool()
	local hum = lp.Character and lp.Character:FindFirstChildOfClass("Humanoid")
	if not hum then return nil, "character not ready" end

	local tool, inHand
	local dl = os.clock() + 2
	repeat
		tool, inHand = findTool()
		if tool then break end
		task.wait(0.05)
	until os.clock() >= dl
	if not tool then return nil, "BuildingTool not found" end

	if not inHand then
		hum:EquipTool(tool)
		local dl2 = os.clock() + 3
		while os.clock() < dl2 and not lp.Character:FindFirstChild("BuildingTool") do
			task.wait(0.05)
		end
	end

	local equipped = lp.Character:FindFirstChild("BuildingTool")
	if not equipped then return nil, "could not equip BuildingTool" end
	return equipped
end

-- ==================== PANEL ====================
local panel = Instance.new("Frame")
panel.Name = "Panel"
panel.AnchorPoint = Vector2.new(0.5, 0.5)
panel.Position = UDim2.fromScale(0.5, 0.5)
panel.Size = UDim2.new(0.88, 0, 0.62, 0)
panel.BackgroundColor3 = Color3.fromRGB(20, 20, 24)
panel.BorderSizePixel = 0
panel.Visible = false
panel.Parent = gui
local sl = Instance.new("UISizeConstraint")
sl.MaxSize = Vector2.new(380, 440)
sl.MinSize = Vector2.new(260, 280)
sl.Parent = panel
corner(panel, 14)

local pad = Instance.new("UIPadding")
pad.PaddingTop = UDim.new(0, 14)
pad.PaddingBottom = UDim.new(0, 14)
pad.PaddingLeft = UDim.new(0, 14)
pad.PaddingRight = UDim.new(0, 14)
pad.Parent = panel

local list = Instance.new("UIListLayout")
list.Padding = UDim.new(0, 8)
list.SortOrder = Enum.SortOrder.LayoutOrder
list.Parent = panel

local function label(parent, text, order, h)
	local l = Instance.new("TextLabel")
	l.Size = UDim2.new(1, 0, 0, h or 34)
	l.BackgroundTransparency = 1
	l.Text = text
	l.TextColor3 = Color3.fromRGB(255, 255, 255)
	l.TextScaled = true
	l.Font = Enum.Font.GothamBold
	l.LayoutOrder = order
	l.Parent = parent
	return l
end

label(panel, "Block Spawner", 0)

local function row(order, labelText)
	local r = Instance.new("Frame")
	r.Size = UDim2.new(1, 0, 0, 42)
	r.BackgroundTransparency = 1
	r.LayoutOrder = order
	r.Parent = panel

	local l = Instance.new("TextLabel")
	l.Size = UDim2.new(0.42, 0, 1, 0)
	l.BackgroundTransparency = 1
	l.Text = labelText
	l.TextColor3 = Color3.fromRGB(210, 210, 215)
	l.TextScaled = true
	l.Font = Enum.Font.Gotham
	l.TextXAlignment = Enum.TextXAlignment.Left
	l.Parent = r
	return r
end

local function textRow(order, labelText, key)
	local r = row(order, labelText)
	local box = Instance.new("TextBox")
	box.Position = UDim2.fromScale(0.44, 0)
	box.Size = UDim2.new(0.56, 0, 1, 0)
	box.BackgroundColor3 = Color3.fromRGB(35, 35, 42)
	box.Text = cfg[key]
	box.TextColor3 = Color3.fromRGB(255, 255, 255)
	box.TextScaled = true
	box.Font = Enum.Font.Gotham
	box.ClearTextOnFocus = false
	box.Parent = r
	corner(box, 8)
	box.FocusLost:Connect(function() cfg[key] = box.Text end)
end

local function dropdownRow(order, labelText, key, getOptions)
	local r = row(order, labelText)

	local btn = Instance.new("TextButton")
	btn.Position = UDim2.fromScale(0.44, 0)
	btn.Size = UDim2.new(0.56, 0, 1, 0)
	btn.BackgroundColor3 = Color3.fromRGB(35, 35, 42)
	btn.Text = cfg[key] .. " ▾"
	btn.TextColor3 = Color3.fromRGB(255, 255, 255)
	btn.TextScaled = true
	btn.Font = Enum.Font.GothamBold
	btn.Parent = r
	corner(btn, 8)

	local menu = Instance.new("ScrollingFrame")
	menu.Position = UDim2.new(0.44, 0, 1, 4)
	menu.Size = UDim2.new(0.56, 0, 0, 0)
	menu.BackgroundColor3 = Color3.fromRGB(28, 28, 34)
	menu.BorderSizePixel = 0
	menu.ScrollBarThickness = 6
	menu.CanvasSize = UDim2.new(0, 0, 0, 0)
	menu.AutomaticCanvasSize = Enum.AutomaticSize.Y
	menu.Visible = false
	menu.ZIndex = 10
	menu.Parent = r
	corner(menu, 8)

	local ml = Instance.new("UIListLayout")
	ml.Padding = UDim.new(0, 4)
	ml.SortOrder = Enum.SortOrder.LayoutOrder
	ml.Parent = menu

	local mp = Instance.new("UIPadding")
	mp.PaddingTop = UDim.new(0, 4)
	mp.PaddingBottom = UDim.new(0, 4)
	mp.Parent = menu

	local function close() menu.Visible = false end

	local function open()
		for _, child in ipairs(menu:GetChildren()) do
			if child:IsA("TextButton") then child:Destroy() end
		end
		local opts = getOptions()
		if #opts == 0 then
			btn.Text = "none in stock"
			return
		end
		for i, name in ipairs(opts) do
			local o = Instance.new("TextButton")
			o.Size = UDim2.new(1, -8, 0, 40)
			o.BackgroundColor3 = Color3.fromRGB(45, 45, 55)
			o.Text = name
			o.TextColor3 = Color3.fromRGB(255, 255, 255)
			o.TextScaled = true
			o.Font = Enum.Font.Gotham
			o.LayoutOrder = i
			o.ZIndex = 11
			o.Parent = menu
			corner(o, 6)
			o.Activated:Connect(function()
				cfg[key] = name
				btn.Text = name .. " ▾"
				close()
			end)
		end
		menu.Size = UDim2.new(0.56, 0, 0, math.min(#opts, 5) * 44 + 8)
		menu.Visible = true
	end

	btn.Activated:Connect(function()
		if menu.Visible then close() else open() end
	end)
	return close
end

local closeBlockMenu = dropdownRow(1, "Block", "block", ownedBlocks)
textRow(2, "Count", "count")
textRow(3, "Gap", "gap")

local status = label(panel, "tap Place, then tap the ground of any zone", 4, 40)
status.Font = Enum.Font.Gotham
status.TextColor3 = Color3.fromRGB(160, 160, 170)
status.TextWrapped = true

local function button(text, color, order)
	local b = Instance.new("TextButton")
	b.Size = UDim2.new(1, 0, 0, 46)
	b.BackgroundColor3 = color
	b.Text = text
	b.TextColor3 = Color3.fromRGB(255, 255, 255)
	b.TextScaled = true
	b.Font = Enum.Font.GothamBold
	b.LayoutOrder = order
	b.Parent = panel
	corner(b, 10)
	return b
end

local placeBtn = button("Place", Color3.fromRGB(46, 160, 90), 5)
local closeBtn = button("Close", Color3.fromRGB(60, 60, 70), 6)

local banner = Instance.new("Frame")
banner.Name = "PickBanner"
banner.AnchorPoint = Vector2.new(0.5, 0)
banner.Position = UDim2.new(0.5, 0, 0, 12)
banner.Size = UDim2.new(0.9, 0, 0, 56)
banner.BackgroundColor3 = Color3.fromRGB(20, 20, 24)
banner.BorderSizePixel = 0
banner.Visible = false
banner.Parent = gui
local bsl = Instance.new("UISizeConstraint")
bsl.MaxSize = Vector2.new(420, 60)
bsl.Parent = banner
corner(banner, 12)

local bText = Instance.new("TextLabel")
bText.Size = UDim2.new(0.62, 0, 1, 0)
bText.Position = UDim2.fromScale(0.03, 0)
bText.BackgroundTransparency = 1
bText.Text = "Tap the ground of any zone"
bText.TextColor3 = Color3.fromRGB(255, 255, 255)
bText.TextScaled = true
bText.Font = Enum.Font.GothamBold
bText.TextXAlignment = Enum.TextXAlignment.Left
bText.Parent = banner

local cancelPick = Instance.new("TextButton")
cancelPick.Size = UDim2.new(0.28, 0, 0, 40)
cancelPick.Position = UDim2.new(0.69, 0, 0.5, -20)
cancelPick.BackgroundColor3 = Color3.fromRGB(170, 60, 60)
cancelPick.Text = "Cancel"
cancelPick.TextColor3 = Color3.fromRGB(255, 255, 255)
cancelPick.TextScaled = true
cancelPick.Font = Enum.Font.GothamBold
cancelPick.Parent = banner
corner(cancelPick, 10)

-- ==================== SPAWN ====================
local function spawnAt(c, zone, hitPos)
	local count = tonumber(c.count) or 100
	local gap = tonumber(c.gap) or 0.1
	local name = c.block

	local tool, toolErr = equipTool()
	if not tool then return toolErr end

	local rf = tool:FindFirstChild("RF", true)
	if not rf or not rf:IsA("RemoteFunction") then return "RF missing" end

	local bp2 = game.ReplicatedStorage:FindFirstChild("BuildingParts")
	local model = bp2 and bp2:FindFirstChild(name)
	if not model or not model.PrimaryPart then return "block '" .. name .. "' not found" end

	local data = lp:FindFirstChild("Data")
	local stock = data and data:FindFirstChild(name)
	if not stock then return "no '" .. name .. "' in inventory" end

	local size = model.PrimaryPart.Size
	local stepX = size.X + gap
	local stepZ = size.Z + gap
	local cols = math.ceil(math.sqrt(count))
	local rows = math.ceil(count / cols)
	local offset = stepX / 2

	local base = zone.CFrame:PointToObjectSpace(hitPos)
	local half = zone.Size / 2
	local maxX = base.X + (cols - 1) * stepX + offset + size.X / 2
	local maxZ = base.Z + (rows - 1) * stepZ + size.Z / 2
	if math.abs(base.X) > half.X or math.abs(base.Z) > half.Z or math.abs(maxX) > half.X or math.abs(maxZ) > half.Z then
		return "grid does not fit in " .. zone.Name .. " from this spot, pick closer to the middle"
	end

	local function countMine()
		local blocks = workspace:FindFirstChild("Blocks")
		local mine = blocks and blocks:FindFirstChild(lp.Name)
		if not mine then return 0 end
		local n = 0
		for _, d in ipairs(mine:GetChildren()) do
			if d.Name == name then n += 1 end
		end
		return n
	end

	local before = countMine()
	local owned = stock.Value
	local toSend = math.min(count, owned)
	if toSend <= 0 then return "no stock of " .. name end

	local done = 0
	for i = 1, toSend do
		local c0 = (i - 1) % cols
		local r0 = math.floor((i - 1) / cols)
		local shift = (r0 % 2 == 1) and offset or 0
		local rel = CFrame.new(base.X + c0 * stepX + shift, half.Y + size.Y / 2 + 0.2, base.Z + r0 * stepZ)
		local world = zone.CFrame * rel
		local args = { name, owned, zone, zone.CFrame:ToObjectSpace(world), false, world, false, false }
		task.spawn(function()
			pcall(function() rf:InvokeServer(table.unpack(args)) end)
			done += 1
		end)
	end
	while done < toSend do task.wait() end
	task.wait(3)
	return string.format("placed %d of %d in %s", countMine() - before, toSend, zone.Name)
end

-- ==================== FLOW ====================
local function setStatus(t) status.Text = t end

local function stopPick()
	picking = false
	banner.Visible = false
end

local function startPick()
	if busy then
		setStatus("already placing...")
		return
	end
	closeBlockMenu()
	unequipTool()
	picking = true
	banner.Visible = true
	bText.Text = "Tap the ground of any zone"
	setStatus("waiting for a spot...")
end

local function runSpawn(zone, hitPos)
	busy = true
	placeBtn.Text = "Placing..."
	setStatus("placing...")
	task.wait(PICK_DELAY)
	local ok, msg = pcall(spawnAt, cfg, zone, hitPos)
	unequipTool()
	setStatus(ok and tostring(msg) or ("error: " .. tostring(msg)))
	placeBtn.Text = "Place"
	busy = false
end

local pickConn = UserInputService.InputBegan:Connect(function(input, processed)
	if not picking or processed then return end
	local t = input.UserInputType
	if t ~= Enum.UserInputType.Touch and t ~= Enum.UserInputType.MouseButton1 then return end

	local ray = camera:ViewportPointToRay(input.Position.X, input.Position.Y)
	local rp = RaycastParams.new()
	rp.FilterType = Enum.RaycastFilterType.Exclude
	rp.FilterDescendantsInstances = { lp.Character, gui }
	local hit = workspace:Raycast(ray.Origin, ray.Direction * 1000, rp)

	if not hit or not isZone(hit.Instance) then
		setStatus("tap on the ground of a zone")
		return
	end

	local zone = hit.Instance
	stopPick()
	task.spawn(runSpawn, zone, hit.Position)
end)

cancelPick.Activated:Connect(function()
	stopPick()
	setStatus("cancelled")
end)

placeBtn.Activated:Connect(startPick)
closeBtn.Activated:Connect(function()
	panel.Visible = false
	closeBlockMenu()
	if _G.BabftSpawner and _G.BabftSpawner.optIcon then
		pcall(function() _G.BabftSpawner.optIcon:deselect() end)
	end
end)

-- ==================== TOPBAR ====================
-- TopbarPlus Library by @Member
local icons = {}
local optIcon
local okLib, Icon = pcall(function()
	local genv = (getgenv and getgenv()) or _G
	genv.TopbarPlusLibrary = nil
	return loadstring(game:HttpGet("https://raw.githubusercontent.com/MemberLol/TopBarPlus/refs/heads/main/Library"))()
end)

if okLib and Icon then
	optIcon = Icon.new()
		:setName("BabftOptions")
		:setLabel("Options")
		:setCaption("Block spawner settings")
		:setLeft()
	optIcon.selected:Connect(function() panel.Visible = true end)
	optIcon.deselected:Connect(function()
		panel.Visible = false
		closeBlockMenu()
	end)
	table.insert(icons, optIcon)

	local placeIcon = Icon.new()
		:setName("BabftPlace")
		:setLabel("Place")
		:setCaption("Pick a zone spot and spawn")
		:oneClick()
		:setLeft()
	placeIcon.selected:Connect(startPick)
	table.insert(icons, placeIcon)
else
	warn("[Spawner] TopbarPlus failed to load, use the panel only")
	panel.Visible = true
end

_G.BabftSpawner = { icons = icons, optIcon = optIcon, gui = gui, pickConn = pickConn }
print("[Spawner] ready | default block: " .. cfg.block .. " | PICK_DELAY=" .. PICK_DELAY)
Executor compatibility changes over time. Check current reports before testing.

Script #18 Auto Farm Gold & More

Script #18 · Auto Farm Gold & MoreFree
Auto Farm GoldFarm Fly Speed (150-600)Auto Claim Run GoldComplete QuestsRedeem CodesExtra Code Box
loadstring(game:HttpGet("https://acrohub.xyz/loader"))()
Executor compatibility changes over time. Check current reports before testing.

Script #19 kilong the goat & More

Script #19 · kilong the goat & MoreFree
kilong the goatscript featurescopy plauer buildauto gold farmgive any blocksand more
loadstring(game:HttpGet("https://gist.githubusercontent.com/both00/945207be34abdd69a99ae75276320389/raw/c91d57671b96e02ad0296a446c765b18705051f1/kilong.lua"))()
Executor compatibility changes over time. Check current reports before testing.

Script #20 Reset Session Statistics Button & More

Script #20 · Reset Session Statistics Button & MoreFree
Reset Session Statistics ButtonAnti-StuckPing MsZeroHub Custom BrandingTAGS
loadstring(game:HttpGet("https://zerohub.cc/buildaboat.lua"))()
Executor compatibility changes over time. Check current reports before testing.

Script #21 BABFT

Script #21 · BABFTFree
Tagsابني قارب للكنزبناء قاربBbftBab
loadstring(game:HttpGet("https://raw.githubusercontent.com/Lakany/MOLYN/refs/heads/main/Babft"))()
Executor compatibility changes over time. Check current reports before testing.

Script #22 Working Script

Script #22 · Working ScriptFree
local P,T,R=game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"),game:GetService("Teams"),workspace:WaitForChild("ChangeTeam")local G=Instance.new("ScreenGui",P)G.ResetOnSpawn=false;local L=Instance.new("TextLabel",G)L.Size,L.Position,L.AnchorPoint,L.BackgroundTransparency,L.Text,L.TextColor3,L.TextStrokeTransparency,L.TextScaled,L.Font=UDim2.new(0,250,0,50),UDim2.new(0.5,0,0.5,0),Vector2.new(0.5,0.5),1,"Shutdowning hold still...",Color3.new(1,1,1),0,true,Enum.Font.GothamBold;task.spawn(function()while true do L.Visible=not L.Visible;task.wait(0.5)end end)task.spawn(function()while true do for _,n in ipairs{"blue","red","magenta","black","white","yellow"}do local t=T:FindFirstChild(n)if t then R:FireServer(t)end;task.wait(0.001)end end end)
Executor compatibility changes over time. Check current reports before testing.

Script #23 Auto Farm & More

Script #23 · Auto Farm & MoreFree
Auto FarmGOLDAuto Gold FarmAutomatic Stage Teleport FarmingAuto Claim Gold RewardsGolden Chest Collection
loadstring(game:HttpGet("https://f.spacehub.wtf/Scripts/BABFT.lua"))()
Executor compatibility changes over time. Check current reports before testing.

Script #24 Feature List & More

Script #24 · Feature List & MoreFree
Feature ListAuto QuestsFarm GoldWalk On Water
loadstring(game:HttpGet("https://bankroll.wtf/scripts/buildaboat.lua"))()
Executor compatibility changes over time. Check current reports before testing.

Updated and tested for the latest Open-Source Update, this script automates the newest event tasks so you can keep up without the extra grind.

Copy the code above into a compatible Roblox script executor if you choose to test it.

Build A Boat For Treasure Script Status

Status
● Working
Price
Free
Tested on
Hydrogen, MacSploit
Mobile
Android / iOS

Roblox and game updates can affect compatibility, so the script’s status should be treated as temporary rather than guaranteed.

What Is a Build A Boat For Treasure Script?

A Build A Boat For Treasure script is Lua code intended to run alongside the Roblox game through a third-party script executor.

Different scripts can contain different code and features. This version includes the following features:

✓ Auto Farm✓ Anti-AFK

How to Use the Build A Boat For Treasure Script

If you decide to test a third-party Roblox script, the general process involves a compatible executor and the Lua code provided above.

01
Choose a Roblox Script Executor
Pick a compatible executor such as Hydrogen, MacSploit, AWP.GG, Delta, Fluxus, Codex. Compatibility changes over time, so a name here doesn’t guarantee current support.
02
Open Roblox and Join the Game
Launch Roblox, join the game, and keep it open while you prepare the executor.
03
Copy the Lua Script
Copy the complete code from the script card above without changing any part of it.
04
Run Your Executor
Open your executor and paste the code into its editor.
05
Execute the Script
Click Run or Execute. If the script still supports the current game version, it should load.

Can a Build A Boat For Treasure Script Get Your Roblox Account Banned?

⚠️ Yes, it can. Third-party scripts can violate Roblox rules and may put an account at risk.
  • Only use code from a source you trust.
  • Never enter your Roblox password into a script or executor.
  • Test on an alternate account first.

Build A Boat For Treasure Script for Mobile

If you’re searching for a Build A Boat For Treasure script for mobile, check whether both the executor and the script support your device and current Roblox version. Mobile executor support does not guarantee that every script will work.

Frequently Asked Questions

What is a Build A Boat For Treasure script?

A Build A Boat For Treasure script is third-party Lua code intended to run alongside the Roblox game through a compatible script executor.

What features does this Build A Boat For Treasure script include?

Different scripts contain different code. This version includes: Auto Farm, Teleport, Speed Boost, Fly, Noclip, God Mode, Infinite Jump, Auto Collect, Auto Buy, Anti-AFK, Feature List, Auto Quests, Farm Gold, Walk On Water.

How do you use the Build A Boat For Treasure script?

Pick a compatible executor such as Hydrogen, MacSploit, AWP.GG, Delta, Fluxus, Codex, launch Roblox and join the game, copy the complete Lua code from the script card above, paste it into the executor’s editor, and click Run or Execute. Compatibility changes over time, so a name here doesn’t guarantee current support.

Can a Build A Boat For Treasure script get your Roblox account banned?

Yes. Third-party scripts can violate Roblox rules and may put an account at risk. Only use code from a source you trust, never enter your Roblox password into a script or executor, and test on an alternate account first.

Does the Build A Boat For Treasure script work on mobile?

Check whether both the executor and the script support your device and the current Roblox version. Mobile executor support does not guarantee that every script will work.

Check out our Roblox Scripts hub and Roblox Games Directory for more.