BOOGA BOOGA KEYLESS OPEN SOURCE
Key RequiredUniversal

BOOGA BOOGA KEYLESS OPEN SOURCE

Universal Scriptvalentinsantos20142valentinsantos20142 1.4K views 4K executesUpdated Sep 13, 2026
0.0/ 5(1 votes)
010% Positive
Lua Script•1094 lines (37472 chars)
--==================================================================--
-- GodsAndPlayersESP — Booga Booga (v4 — MÁXIMA OTIMIZAÇÃO)
--
-- • SEM beacons (eram a causa da multiplicação/travamento)
-- • Limpa TODOS os "GodBeacon" deixados pela versão antiga ao iniciar
-- • Scan do mapa em segundo plano, em pedaços (não trava frames)
-- • Detecção de deuses por EVENTO (DescendantAdded), custo ~zero
-- • Raízes em cache, textos só atualizam quando mudam
-- • Anti-duplicação via getgenv (reexecutar é 100% seguro)
--
-- Execute pelo executor. Atalho da UI: Right Shift
--==================================================================--

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

local LocalPlayer = Players.LocalPlayer

--============================--
-- Rayfield Gen2
--============================--
local Rayfield
do
    local ok, err = pcall(function()
        Rayfield = loadstring(game:HttpGet("https://sirius.menu/gen2"))()
    end)
    if not ok or not Rayfield then
        warn("[ESP] Não foi possível carregar a Rayfield: " .. tostring(err))
        return
    end
end

--============================--
-- Configurações
--============================--
local Settings = {
    -- Deuses
    GodsESP = false,
    GodHighlight = true,
    GodName = true,
    GodDistance = true,
    GodVisCheck = true,
    GodColor = Color3.fromRGB(255, 80, 170),
    GodMaxDist = 10000,
    GodDebug = false,

    -- Jogadores
    PlayersESP = false,
    PlayerBox2D = false,
    PlayerBox3D = false,
    PlayerName = false,
    PlayerDistance = false,
    PlayerHealth = false,
    PlayerHealthBar = false,
    PlayerSkeleton = false,
    PlayerChams = false,
    PlayerVisCheck = false,
    PlayerColor = Color3.fromRGB(80, 255, 170),
    PlayerTeamColor = true,
    PlayerMaxDist = 5000,
}

local GODS_LIST = {
    "Old God", "Hateful God", "Miserable God", "Lonely God", "Wealthy God",
    "Sleeping God", "Ancient God", "Pink God", "Furious God", "Magical God",
    "Strange God", "Odd God", "Dark God", "Soulless God", "Infinity God",
}

-- Nomes "limpos" pré-computados UMA vez (evita gsub em cada checagem)
local CLEAN_GODS = {}
for i = 1, #GODS_LIST do
    CLEAN_GODS[i] = (string.gsub(string.lower(GODS_LIST[i]), "[%s_%%-]", ""))
end

local FALSE_POSITIVES = { "godray" }

local HEAVY_INTERVAL = 0.15  -- raycast/distância/textos (6-7x por segundo)
local GOD_INTERVAL   = 0.15  -- atualização dos deuses (billboard segue sozinho)

--============================--
-- Drawing (apenas para Skeleton)
--============================--
local DrawingSupported = false
do
    local ok = pcall(function()
        local t = Drawing.new("Line")
        t:Remove()
    end)
    DrawingSupported = ok
end

local SKELETON_R15 = {
    {"Head", "UpperTorso"},
    {"UpperTorso", "LowerTorso"},
    {"UpperTorso", "LeftUpperArm"}, {"LeftUpperArm", "LeftLowerArm"}, {"LeftLowerArm", "LeftHand"},
    {"UpperTorso", "RightUpperArm"}, {"RightUpperArm", "RightLowerArm"}, {"RightLowerArm", "RightHand"},
    {"LowerTorso", "LeftUpperLeg"}, {"LeftUpperLeg", "LeftLowerLeg"}, {"LeftLowerLeg", "LeftFoot"},
    {"LowerTorso", "RightUpperLeg"}, {"RightUpperLeg", "RightLowerLeg"}, {"RightLowerLeg", "RightFoot"},
}

local SKELETON_R6 = {
    {"Head", "Torso"},
    {"Torso", "Left Arm"}, {"Torso", "Right Arm"},
    {"Torso", "Left Leg"}, {"Torso", "Right Leg"},
}

--============================--
-- ANTI-DUPLICAÇÃO
-- Mata a instância anterior do script (conexões, pastas, desenhos)
--============================--
if getgenv().GodsPlayersESP_Destroy then
    pcall(getgenv().GodsPlayersESP_Destroy)
end

local Active = true
local Connections = {}
local function track(conn)
    Connections[#Connections + 1] = conn
    return conn
end

--============================--
-- VARREDURA: destruir beacons "GodBeacon" da versão antiga
-- (conserta o jogo que está travado AGORA)
--============================--
task.spawn(function()
    local descendants = Workspace:GetDescendants()
    for i = 1, #descendants do
        local inst = descendants[i]
        if inst.Name == "GodBeacon" then
            pcall(function() inst:Destroy() end)
        end
    end
end)

--============================--
-- Containers
--============================--
for _, name in ipairs({"GodsESP_Folder", "PlayersESP_Folder", "ESP_2D_ScreenGui"}) do
    local old = CoreGui:FindFirstChild(name)
    if old then old:Destroy() end
end

local GodsFolder = Instance.new("Folder")
GodsFolder.Name = "GodsESP_Folder"
GodsFolder.Parent = CoreGui

local PlayersFolder = Instance.new("Folder")
PlayersFolder.Name = "PlayersESP_Folder"
PlayersFolder.Parent = CoreGui

local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "ESP_2D_ScreenGui"
ScreenGui.ResetOnSpawn = false
ScreenGui.IgnoreGuiInset = true
ScreenGui.DisplayOrder = 999
ScreenGui.Parent = CoreGui

local GodESPData = {}
local PlayerESPData = {}
local CachedPlayers = {} -- cache de players (sem alocar array por frame)

--============================--
-- Raycast (params REUTILIZÁVEIS — sem criar instância por chamada)
--============================--
local RayParams = RaycastParams.new()
RayParams.FilterType = Enum.RaycastFilterType.Exclude
RayParams.IgnoreWater = true

local function IsVisible(part, origin, ignoreModel)
    local dir = part.Position - origin
    if dir.Magnitude < 0.1 then return true end

    local myChar = LocalPlayer.Character
    if ignoreModel and myChar then
        RayParams.FilterDescendantsInstances = {myChar, ignoreModel}
    elseif ignoreModel then
        RayParams.FilterDescendantsInstances = {ignoreModel}
    elseif myChar then
        RayParams.FilterDescendantsInstances = {myChar}
    else
        RayParams.FilterDescendantsInstances = {}
    end

    local result = Workspace:Raycast(origin, dir, RayParams)
    if not result then return true end
    local hit = result.Instance
    return hit == part or hit:IsDescendantOf(part)
end

--============================--
-- Detecção de deuses
--============================--
local function IsGodName(rawName)
    local lower = string.lower(rawName)
    -- early-out: 99,9% dos objetos nem têm "god" no nome (1 único find)
    if not string.find(lower, "god", 1, true) then return false end

    local clean = string.gsub(lower, "[%s_%%-]", "")
    for i = 1, #CLEAN_GODS do
        if string.find(clean, CLEAN_GODS[i], 1, true) then return true end
    end
    for i = 1, #FALSE_POSITIVES do
        if string.find(clean, FALSE_POSITIVES[i], 1, true) then return false end
    end
    return true
end

local function ResolveGodRoot(god)
    if god:IsA("BasePart") then return god end
    local pp = god.PrimaryPart
    if pp and pp.Parent then return pp end
    for _, c in ipairs(god:GetChildren()) do
        if c:IsA("BasePart") then return c end
    end
    for _, d in ipairs(god:GetDescendants()) do
        if d:IsA("BasePart") then return d end
    end
    return nil
end

local function ComputeGodOffset(god)
    -- chamado UMA vez por deus (na criação), nunca por frame
    local ok, size = pcall(function()
        if god:IsA("Model") then
            return select(2, god:GetBoundingBox())
        elseif god:IsA("BasePart") then
            return god.Size
        end
        return Vector3.zero
    end)
    if ok and size and size.Y > 0 then
        return Vector3.new(0, size.Y * 0.5 + 3, 0)
    end
    return Vector3.new(0, 6, 0)
end

--============================--
-- ESP DE DEUSES
--============================--
local function CreateGodVisuals(god)
    if GodESPData[god] then return end

    local folder = Instance.new("Folder")
    folder.Name = "GodVisuals_" .. god.Name

    local highlight = Instance.new("Highlight")
    highlight.FillColor = Settings.GodColor
    highlight.FillTransparency = 0.45
    highlight.OutlineColor = Settings.GodColor
    highlight.OutlineTransparency = 0
    highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
    highlight.Adornee = god
    highlight.Enabled = false
    highlight.Parent = folder

    local billboard = Instance.new("BillboardGui")
    billboard.Size = UDim2.fromOffset(280, 34)
    billboard.StudsOffset = ComputeGodOffset(god)
    billboard.AlwaysOnTop = true
    billboard.LightInfluence = 0
    billboard.MaxDistance = Settings.GodMaxDist
    billboard.Enabled = false
    billboard.Parent = folder

    local label = Instance.new("TextLabel")
    label.Size = UDim2.fromScale(1, 1)
    label.BackgroundTransparency = 1
    label.TextColor3 = Settings.GodColor
    label.TextStrokeTransparency = 0.25
    label.Font = Enum.Font.GothamBold
    label.TextScaled = true
    label.Text = ""
    label.Parent = billboard

    folder.Parent = GodsFolder

    GodESPData[god] = {
        god = god,
        folder = folder,
        highlight = highlight,
        billboard = billboard,
        label = label,
        root = nil,
        lastRoot = nil,
        rootRetryAt = 0,
        lastText = nil,
        labelColor = nil,
        rangeOn = false,
    }

    if Settings.GodDebug then
        print("[GodESP] Registrado: " .. god.Name .. " (" .. god.ClassName .. ")")
    end
end

local function UpdateGodVisuals(god, data, cam, now)
    if not god.Parent then
        if data.folder then pcall(function() data.folder:Destroy() end) end
        GodESPData[god] = nil
        return
    end

    -- raiz em CACHE: só re-resolve (GetDescendants) 1x/segundo se invalidar
    local root = data.root
    if not root or not root.Parent then
        root = nil
        if (now - data.rootRetryAt) >= 1 then
            data.rootRetryAt = now
            root = ResolveGodRoot(god)
            data.root = root
        end
        if not root then
            data.highlight.Enabled = false
            data.billboard.Enabled = false
            return
        end
    end

    local dist = (root.Position - cam.CFrame.Position).Magnitude
    if dist > Settings.GodMaxDist then
        if data.rangeOn then
            data.rangeOn = false
            data.highlight.Enabled = false
            data.billboard.Enabled = false
        end
        return
    end
    data.rangeOn = true

    local visible = true
    if Settings.GodVisCheck then
        visible = IsVisible(root, cam.CFrame.Position, god)
    end

    data.highlight.Enabled = Settings.GodHighlight and visible
    data.highlight.FillColor = Settings.GodColor
    data.highlight.OutlineColor = Settings.GodColor

    if data.lastRoot ~= root then
        data.lastRoot = root
        data.billboard.Adornee = root -- billboard segue o deus sozinho depois disso
    end

    local showText = Settings.GodName or Settings.GodDistance
    data.billboard.Enabled = showText
    if showText then
        local text = ""
        if Settings.GodName then text = god.Name end
        if Settings.GodDistance then
            if text ~= "" then text = text .. "  •  " end
            text = text .. string.format("%.0fm", dist)
        end
        if data.lastText ~= text then -- só re-renderiza o texto quando MUDA
            data.lastText = text
            data.label.Text = text
        end
        if data.labelColor ~= Settings.GodColor then
            data.labelColor = Settings.GodColor
            data.label.TextColor3 = Settings.GodColor
        end
        data.billboard.MaxDistance = Settings.GodMaxDist
    end
end

local function TryRegisterGod(inst)
    if GodESPData[inst] then return end
    if not (inst:IsA("Model") or inst:IsA("BasePart")) then return end
    if not IsGodName(inst.Name) then return end
    if Players:GetPlayerFromCharacter(inst) then return end
    CreateGodVisuals(inst)
end

-- Scan EM SEGUNDO PLANO, em pedaços: nunca trava um frame
local function StartGodScan()
    task.spawn(function()
        local ok, err = pcall(function()
            local stack = {Workspace}
            local processed = 0
            while #stack > 0 and Active do
                if not Settings.GodsESP then break end
                local inst = table.remove(stack)
                TryRegisterGod(inst)
                local children = inst:GetChildren()
                for i = 1, #children do
                    stack[#stack + 1] = children[i]
                end
                processed += 1
                if processed % 4096 == 0 then
                    task.wait() -- entrega o frame pro jogo
                end
            end
        end)
        if not ok then
            warn("[ESP] Erro no scan de deuses: " .. tostring(err))
        end
    end)
end

-- Detecção por EVENTO: novos deuses aparecem instantaneamente, custo ~zero
track(Workspace.DescendantAdded:Connect(function(inst)
    if Active and Settings.GodsESP then
        TryRegisterGod(inst)
    end
end))

local function ClearGodsESP()
    for god, data in pairs(GodESPData) do
        if data.folder then pcall(function() data.folder:Destroy() end) end
    end
    table.clear(GodESPData)
end

--============================--
-- ESP DE JOGADORES
--============================--
local function RemovePlayerVisuals(player)
    local data = PlayerESPData[player]
    if not data then return end
    PlayerESPData[player] = nil
    pcall(function() data.folder:Destroy() end)
    pcall(function() data.box2d:Destroy() end)
    pcall(function() data.healthbar:Destroy() end)
    if data.box3d then pcall(function() data.box3d:Destroy() end) end
    if data.skeletonLines then
        for i = 1, #data.skeletonLines do
            pcall(function() data.skeletonLines[i]:Remove() end)
        end
    end
end

local function CreatePlayerVisuals(player)
    if player == LocalPlayer then return nil end
    local data = PlayerESPData[player]
    if data then return data end

    local folder = Instance.new("Folder")
    folder.Name = "PlayerVisuals_" .. player.Name

    -- Chams (segue o personagem sozinho via Adornee)
    local chams = Instance.new("Highlight")
    chams.FillColor = Settings.PlayerColor
    chams.FillTransparency = 0.7
    chams.OutlineColor = Settings.PlayerColor
    chams.OutlineTransparency = 0
    chams.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
    chams.Enabled = false
    chams.Parent = folder

    -- Billboard
    local billboard = Instance.new("BillboardGui")
    billboard.Size = UDim2.fromOffset(220, 58)
    billboard.StudsOffset = Vector3.new(0, 3, 0)
    billboard.AlwaysOnTop = true
    billboard.LightInfluence = 0
    billboard.Enabled = false
    billboard.Parent = folder

    local nameLabel = Instance.new("TextLabel")
    nameLabel.Size = UDim2.new(1, 0, 0, 24)
    nameLabel.BackgroundTransparency = 1
    nameLabel.TextColor3 = Settings.PlayerColor
    nameLabel.TextStrokeTransparency = 0.3
    nameLabel.Font = Enum.Font.GothamBold
    nameLabel.TextScaled = true
    nameLabel.Text = player.Name
    nameLabel.Parent = billboard

    local distLabel = Instance.new("TextLabel")
    distLabel.Position = UDim2.fromOffset(0, 24)
    distLabel.Size = UDim2.new(1, 0, 0, 16)
    distLabel.BackgroundTransparency = 1
    distLabel.TextColor3 = Settings.PlayerColor
    distLabel.TextStrokeTransparency = 0.5
    distLabel.Font = Enum.Font.Gotham
    distLabel.TextScaled = true
    distLabel.Text = ""
    distLabel.Parent = billboard

    local healthLabel = Instance.new("TextLabel")
    healthLabel.Position = UDim2.fromOffset(0, 42)
    healthLabel.Size = UDim2.new(1, 0, 0, 16)
    healthLabel.BackgroundTransparency = 1
    healthLabel.TextColor3 = Color3.fromRGB(255, 100, 100)
    healthLabel.TextStrokeTransparency = 0.5
    healthLabel.Font = Enum.Font.Gotham
    healthLabel.TextScaled = true
    healthLabel.Text = ""
    healthLabel.Parent = billboard

    -- Box 3D (SelectionBox no personagem, segue sozinho)
    local box3d = Instance.new("SelectionBox")
    box3d.SurfaceTransparency = 1
    box3d.LineThickness = 0.05
    box3d.Color3 = Settings.PlayerColor
    box3d.Visible = false
    box3d.Parent = Workspace.CurrentCamera

    -- Box 2D
    local box2d = Instance.new("Frame")
    box2d.BackgroundColor3 = Color3.new(0, 0, 0)
    box2d.BackgroundTransparency = 0.7
    box2d.BorderSizePixel = 0
    box2d.Visible = false
    box2d.Parent = ScreenGui

    local box2dStroke = Instance.new("UIStroke")
    box2dStroke.Color = Settings.PlayerColor
    box2dStroke.Thickness = 1.2
    box2dStroke.Parent = box2d

    -- Healthbar
    local hbBg = Instance.new("Frame")
    hbBg.Size = UDim2.fromOffset(4, 60)
    hbBg.BackgroundColor3 = Color3.new(0, 0, 0)
    hbBg.BackgroundTransparency = 0.5
    hbBg.BorderSizePixel = 0
    hbBg.Visible = false
    hbBg.Parent = ScreenGui

    local hbFill = Instance.new("Frame")
    hbFill.AnchorPoint = Vector2.new(0, 1)
    hbFill.Position = UDim2.new(0, 0, 1, 0)
    hbFill.Size = UDim2.fromScale(1, 1)
    hbFill.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
    hbFill.BorderSizePixel = 0
    hbFill.Parent = hbBg

    folder.Parent = PlayersFolder

    data = {
        player = player,
        folder = folder,
        chams = chams,
        billboard = billboard,
        nameLabel = nameLabel,
        distLabel = distLabel,
        healthLabel = healthLabel,
        box3d = box3d,
        box2d = box2d,
        box2dStroke = box2dStroke,
        healthbar = hbBg,
        healthbarFill = hbFill,
        skeletonLines = {},
        lastHeavy = 0,
        shown = false,
        boxShown = false,
        hbShown = false,
        skelOn = false,
        visible = false,
    }
    PlayerESPData[player] = data
    return data
end

local function HideSkeleton(data)
    if not data.skelOn then return end -- early-out: não faz loop à toa
    data.skelOn = false
    local lines = data.skeletonLines
    for i = 1, #lines do
        pcall(function() lines[i].Visible = false end)
    end
end

local function UpdateSkeleton(data, char, cam, color)
    if not Settings.PlayerSkeleton or not DrawingSupported or not char then
        HideSkeleton(data)
        return
    end

    local list = SKELETON_R6
    if not char:FindFirstChild("Torso") then
        list = char:FindFirstChild("UpperTorso") and SKELETON_R15 or nil
    end
    if not list then
        HideSkeleton(data)
        return
    end

    data.skelOn = true
    local lines = data.skeletonLines
    for i = 1, #list do
        local line = lines[i]
        if not line then
            local ok, l = pcall(Drawing.new, "Line")
            if ok then
                l.Thickness = 1
                l.Transparency = 1
                l.Visible = false
                lines[i] = l
                line = l
            end
        end
        if line then
            local a = char:FindFirstChild(list[i][1])
            local b = char:FindFirstChild(list[i][2])
            if a and b then
                local pa, oa = cam:WorldToViewportPoint(a.Position)
                local pb, ob = cam:WorldToViewportPoint(b.Position)
                if oa and ob then
                    line.From = Vector2.new(pa.X, pa.Y)
                    line.To = Vector2.new(pb.X, pb.Y)
                    line.Color = color
                    if not line.Visible then line.Visible = true end
                elseif line.Visible then
                    line.Visible = false
                end
            elseif line.Visible then
                line.Visible = false
            end
        end
    end
    for i = #list + 1, #lines do
        if lines[i] and lines[i].Visible then
            lines[i].Visible = false
        end
    end
end

-- Atualização "pesada" (raycast, distância, textos): só a cada 150ms
local function UpdatePlayerHeavy(player, data, cam)
    local char = player.Character
    local humanoid = char and char:FindFirstChildOfClass("Humanoid")
    local root = char and (char:FindFirstChild("HumanoidRootPart") or char.PrimaryPart or char:FindFirstChildWhichIsA("BasePart"))
    local head = char and (char:FindFirstChild("Head") or root)

    data.char = char
    data.root = root
    data.head = head

    local visible = false
    local dist = math.huge
    local hp = 0

    if root and head and humanoid and humanoid.Health > 0 then
        dist = (root.Position - cam.CFrame.Position).Magnitude
        hp = math.clamp(humanoid.Health / math.max(humanoid.MaxHealth, 0.01), 0, 1)
        if dist <= Settings.PlayerMaxDist then
            if Settings.PlayerVisCheck then
                visible = IsVisible(head, cam.CFrame.Position, char)
            else
                visible = true
            end
        end
    end

    data.dist = dist
    data.hp = hp
    data.visible = visible

    if not visible then
        if data.shown then -- esconde UMA vez, não todo frame
            data.shown = false
            data.chams.Enabled = false
            data.billboard.Enabled = false
            if data.box3d then data.box3d.Visible = false end
            data.box2d.Visible = false
            data.healthbar.Visible = false
            data.boxShown = false
            data.hbShown = false
            HideSkeleton(data)
        end
        return
    end
    data.shown = true

    local color = Settings.PlayerColor
    if Settings.PlayerTeamColor and player.Team then
        color = player.TeamColor.Color
    end
    if data.color ~= color then -- cores só quando mudam
        data.color = color
        data.box2dStroke.Color = color
        data.chams.FillColor = color
        data.chams.OutlineColor = color
        data.nameLabel.TextColor3 = color
        data.distLabel.TextColor3 = color
        if data.box3d then data.box3d.Color3 = color end
    end

    -- adornees só quando o personagem muda (não todo frame)
    if data.lastAdorn ~= char then
        data.lastAdorn = char
        data.chams.Adornee = char
        if data.box3d then data.box3d.Adornee = char end
        data.billboard.Adornee = head
    end

    data.chams.Enabled = Settings.PlayerChams

    if data.box3d then
        if data.box3d.Parent ~= cam then -- câmera recriada (respawn)?
            local ok = pcall(function() data.box3d.Parent = cam end)
            if not ok then
                local nb = Instance.new("SelectionBox")
                nb.SurfaceTransparency = 1
                nb.LineThickness = 0.05
                nb.Color3 = color
                nb.Adornee = char
                nb.Parent = cam
                data.box3d = nb
            end
        end
        data.box3d.Visible = Settings.PlayerBox3D
    end

    local anyText = Settings.PlayerName or Settings.PlayerDistance or Settings.PlayerHealth
    data.billboard.Enabled = anyText
    if anyText then
        data.nameLabel.Visible = Settings.PlayerName
        data.distLabel.Visible = Settings.PlayerDistance
        data.healthLabel.Visible = Settings.PlayerHealth

        if Settings.PlayerName then
            local t = player.Name
            if player.DisplayName ~= player.Name then
                t = player.DisplayName .. " (" .. player.Name .. ")"
            end
            if data.lastName ~= t then
                data.lastName = t
                data.nameLabel.Text = t
            end
        end
        if Settings.PlayerDistance then
            local t = string.format("%.0fm", dist)
            if data.lastDist ~= t then
                data.lastDist = t
                data.distLabel.Text = t
            end
        end
        if Settings.PlayerHealth then
            local t = string.format("%d/%d", math.floor(humanoid.Health + 0.5), math.floor(humanoid.MaxHealth + 0.5))
            if data.lastHpText ~= t then
                data.lastHpText = t
                data.healthLabel.Text = t
            end
        end
    end
end

-- Atualização POR FRAME: só Box 2D + Healthbar + Skeleton (o resto segue sozinho)
local function UpdatePlayerFrame(data, cam)
    local char = data.char

    if Settings.PlayerSkeleton and DrawingSupported and char then
        UpdateSkeleton(data, char, cam, data.color or Settings.PlayerColor)
    else
        HideSkeleton(data)
    end

    if not (Settings.PlayerBox2D or Settings.PlayerHealthBar) then
        if data.boxShown then data.boxShown = false; data.box2d.Visible = false end
        if data.hbShown then data.hbShown = false; data.healthbar.Visible = false end
        return
    end

    local head, root = data.head, data.root
    if not head or not root then return end

    local headPos, headOn = cam:WorldToViewportPoint(head.Position + Vector3.new(0, 1, 0))
    local footPos, footOn = cam:WorldToViewportPoint(root.Position - Vector3.new(0, 3, 0))

    if headOn and footOn then
        local height = math.abs(footPos.Y - headPos.Y)
        if height < 6 then height = 6 end
        local width = math.max(height * 0.6, 10)
        local x = headPos.X - width * 0.5
        local y = math.min(headPos.Y, footPos.Y)

        if Settings.PlayerBox2D then
            data.box2d.Position = UDim2.fromOffset(x, y)
            data.box2d.Size = UDim2.fromOffset(width, height)
            if not data.boxShown then
                data.boxShown = true
                data.box2d.Visible = true
            end
        elseif data.boxShown then
            data.boxShown = false
            data.box2d.Visible = false
        end

        if Settings.PlayerHealthBar then
            data.healthbar.Position = UDim2.fromOffset(x - 8, y)
            data.healthbar.Size = UDim2.fromOffset(4, height)
            if data.lastHp ~= data.hp then
                data.lastHp = data.hp
                data.healthbarFill.Size = UDim2.fromScale(1, data.hp)
                data.healthbarFill.BackgroundColor3 = Color3.new(1 - data.hp, data.hp, 0)
            end
            if not data.hbShown then
                data.hbShown = true
                data.healthbar.Visible = true
            end
        elseif data.hbShown then
            data.hbShown = false
            data.healthbar.Visible = false
        end
    else
        if data.boxShown then data.boxShown = false; data.box2d.Visible = false end
        if data.hbShown then data.hbShown = false; data.healthbar.Visible = false end
    end
end

local function ClearPlayersESP()
    for player in pairs(PlayerESPData) do
        RemovePlayerVisuals(player)
    end
    table.clear(PlayerESPData)
end

--============================--
-- Cache de players (eventos, sem alocação por frame)
--============================--
track(Players.PlayerAdded:Connect(function(p)
    if p ~= LocalPlayer then
        CachedPlayers[#CachedPlayers + 1] = p
    end
end))

track(Players.PlayerRemoving:Connect(function(p)
    RemovePlayerVisuals(p)
    for i = #CachedPlayers, 1, -1 do
        if CachedPlayers[i] == p then
            table.remove(CachedPlayers, i)
            break
        end
    end
end))

for _, p in ipairs(Players:GetPlayers()) do
    if p ~= LocalPlayer then
        CachedPlayers[#CachedPlayers + 1] = p
    end
end

--============================--
-- LOOP PRINCIPAL (uma única conexão, trabalho mínimo por frame)
--============================--
local LastGodTick = 0

track(RunService.RenderStepped:Connect(function()
    if not Active then return end
    local cam = Workspace.CurrentCamera
    if not cam then return end
    local now = os.clock()

    if Settings.PlayersESP then
        local perFrame2D = Settings.PlayerBox2D or Settings.PlayerHealthBar
            or (Settings.PlayerSkeleton and DrawingSupported)

        for i = 1, #CachedPlayers do
            local plr = CachedPlayers[i]
            if plr.Parent then
                local data = PlayerESPData[plr]
                if not data then
                    data = CreatePlayerVisuals(plr)
                end
                if data then
                    if (now - data.lastHeavy) >= HEAVY_INTERVAL then
                        data.lastHeavy = now
                        UpdatePlayerHeavy(plr, data, cam)
                    end
                    if data.visible and perFrame2D then
                        UpdatePlayerFrame(data, cam)
                    end
                end
            else
                RemovePlayerVisuals(plr)
            end
        end
    end

    -- Deuses: NADA por frame (billboard/highlight seguem sozinhos).
    -- Só checagens leves a cada 150ms.
    if Settings.GodsESP and (now - LastGodTick) >= GOD_INTERVAL then
        LastGodTick = now
        for god, data in pairs(GodESPData) do
            UpdateGodVisuals(god, data, cam, now)
        end
    end
end))

--============================--
-- Cleanup completo (usado ao reexecutar o script)
--============================--
local function FullCleanup()
    Active = false
    for i = 1, #Connections do
        pcall(function() Connections[i]:Disconnect() end)
    end
    table.clear(Connections)

    ClearPlayersESP()
    for god, data in pairs(GodESPData) do
        if data.folder then pcall(function() data.folder:Destroy() end) end
    end
    table.clear(GodESPData)

    pcall(function() GodsFolder:Destroy() end)
    pcall(function() PlayersFolder:Destroy() end)
    pcall(function() ScreenGui:Destroy() end)
    pcall(function() Rayfield:Destroy() end)

    -- remove beacons de QUALQUER versão
    pcall(function()
        for _, inst in ipairs(Workspace:GetDescendants()) do
            if inst.Name == "GodBeacon" then
                inst:Destroy()
            end
        end
    end)
end

getgenv().GodsPlayersESP_Destroy = FullCleanup

--============================--
-- INTERFACE RAYFIELD
--============================--
local Window = Rayfield:CreateWindow({
    Name = "Gods & Players ESP",
    Subtitle = "Booga Booga — v4 Otimizado",
    Icon = 13641909418,
    SidebarLayout = true,
    DisableBuildWarnings = true,
    ConfigurationSaving = {
        Enabled = true,
        FolderName = "ESP_Valentin",
        FileName = "Config",
    },
})

local function AddText(tab, info)
    if typeof(tab.CreateText) == "function" then
        tab:CreateText(info)
    elseif typeof(tab.CreateParagraph) == "function" then
        tab:CreateParagraph(info)
    end
end

-- ===== TAB: GODS =====
local GodsTab = Window:CreateTab({ Name = "Gods ESP", Icon = 111088561600820 })

GodsTab:CreateSection("Controles")
GodsTab:CreateToggle({
    Name = "Ativar ESP de Deuses",
    CurrentValue = Settings.GodsESP,
    Flag = "GodsESP",
    Callback = function(v)
        Settings.GodsESP = v
        if v then
            StartGodScan()
        else
            ClearGodsESP()
        end
    end,
})

GodsTab:CreateSection("Visual")
GodsTab:CreateToggle({ Name = "Highlight (Brilho)", CurrentValue = Settings.GodHighlight, Flag = "GodHighlight", Callback = function(v) Settings.GodHighlight = v end })
GodsTab:CreateToggle({ Name = "Mostrar Nome", CurrentValue = Settings.GodName, Flag = "GodName", Callback = function(v) Settings.GodName = v end })
GodsTab:CreateToggle({ Name = "Mostrar Distância", CurrentValue = Settings.GodDistance, Flag = "GodDistance", Callback = function(v) Settings.GodDistance = v end })
GodsTab:CreateToggle({ Name = "Verificar Visibilidade", CurrentValue = Settings.GodVisCheck, Flag = "GodVisCheck", Callback = function(v) Settings.GodVisCheck = v end })

GodsTab:CreateSection("Cores")
GodsTab:CreateColorPicker({ Name = "Cor dos Deuses", Color = Settings.GodColor, Flag = "GodColor", Callback = function(v) Settings.GodColor = v end })
GodsTab:CreateSlider({ Name = "Distância Máxima", Range = {100, 20000}, Increment = 100, CurrentValue = Settings.GodMaxDist, Flag = "GodMaxDist", Callback = function(v) Settings.GodMaxDist = v end })

GodsTab:CreateSection("Debug")
GodsTab:CreateToggle({ Name = "Modo Debug (console)", CurrentValue = Settings.GodDebug, Flag = "GodDebug", Callback = function(v) Settings.GodDebug = v end })
GodsTab:CreateButton({
    Name = "Escanear Deuses Agora",
    Callback = function()
        StartGodScan()
    end,
})
GodsTab:CreateButton({
    Name = "Listar objetos com 'god' (ver console)",
    Callback = function()
        task.spawn(function()
            local count = 0
            for _, inst in ipairs(Workspace:GetDescendants()) do
                if string.find(string.lower(inst.Name), "god", 1, true) then
                    count += 1
                    print("→ " .. inst:GetFullName() .. " (" .. inst.ClassName .. ")")
                end
            end
            print("[GodESP] Total de objetos com 'god' no nome: " .. count)
        end)
    end,
})

AddText(GodsTab, {
    Title = "Performance",
    Content = "Deuses custam QUASE ZERO de FPS: o highlight/billboard seguem o modelo sozinhos e as checagens rodam só 6x por segundo. Novos deuses são detectados por evento, instantaneamente.",
})

-- ===== TAB: PLAYERS =====
local PlayersTab = Window:CreateTab({ Name = "Players ESP", Icon = 13641909418 })

PlayersTab:CreateSection("Controles")
PlayersTab:CreateToggle({
    Name = "Ativar ESP de Jogadores",
    CurrentValue = Settings.PlayersESP,
    Flag = "PlayersESP",
    Callback = function(v)
        Settings.PlayersESP = v
        if not v then ClearPlayersESP() end
    end,
})

PlayersTab:CreateSection("Boxes")
PlayersTab:CreateToggle({ Name = "Box 2D", CurrentValue = Settings.PlayerBox2D, Flag = "PlayerBox2D", Callback = function(v) Settings.PlayerBox2D = v end })
PlayersTab:CreateToggle({ Name = "Box 3D", CurrentValue = Settings.PlayerBox3D, Flag = "PlayerBox3D", Callback = function(v) Settings.PlayerBox3D = v end })

PlayersTab:CreateSection("Informações")
PlayersTab:CreateToggle({ Name = "Mostrar Nome", CurrentValue = Settings.PlayerName, Flag = "PlayerName", Callback = function(v) Settings.PlayerName = v end })
PlayersTab:CreateToggle({ Name = "Mostrar Distância", CurrentValue = Settings.PlayerDistance, Flag = "PlayerDistance", Callback = function(v) Settings.PlayerDistance = v end })
PlayersTab:CreateToggle({ Name = "Mostrar Vida", CurrentValue = Settings.PlayerHealth, Flag = "PlayerHealth", Callback = function(v) Settings.PlayerHealth = v end })
PlayersTab:CreateToggle({ Name = "Healthbar 2D", CurrentValue = Settings.PlayerHealthBar, Flag = "PlayerHealthBar", Callback = function(v) Settings.PlayerHealthBar = v end })
PlayersTab:CreateToggle({ Name = "Skeleton (custa mais FPS)", CurrentValue = Settings.PlayerSkeleton, Flag = "PlayerSkeleton", Callback = function(v) Settings.PlayerSkeleton = v end })

PlayersTab:CreateSection("Visual")
PlayersTab:CreateToggle({ Name = "Chams", CurrentValue = Settings.PlayerChams, Flag = "PlayerChams", Callback = function(v) Settings.PlayerChams = v end })
PlayersTab:CreateToggle({ Name = "Verificar Visibilidade", CurrentValue = Settings.PlayerVisCheck, Flag = "PlayerVisCheck", Callback = function(v) Settings.PlayerVisCheck = v end })
PlayersTab:CreateToggle({ Name = "Usar Cor do Time", CurrentValue = Settings.PlayerTeamColor, Flag = "PlayerTeamColor", Callback = function(v) Settings.PlayerTeamColor = v end })
PlayersTab:CreateColorPicker({ Name = "Cor Padrão", Color = Settings.PlayerColor, Flag = "PlayerColor", Callback = function(v) Settings.PlayerColor = v end })
PlayersTab:CreateSlider({ Name = "Distância Máxima", Range = {100, 10000}, Increment = 100, CurrentValue = Settings.PlayerMaxDist, Flag = "PlayerMaxDist", Callback = function(v) Settings.PlayerMaxDist = v end })

AddText(PlayersTab, {
    Title = "Performance",
    Content = DrawingSupported
        and "Chams/Nome/Vida/Box3D custam quase zero (seguem o personagem sozinhos, atualizados 6x/s). Só Box 2D, Healthbar e Skeleton rodam por frame — o Skeleton é o mais pesado."
        or "Aviso: seu executor NÃO tem a biblioteca Drawing, então o Skeleton não funciona (o resto funciona normalmente).",
})

-- ===== TAB: MISC =====
local MiscTab = Window:CreateTab({ Name = "Misc", Icon = 4779510615 })

MiscTab:CreateButton({
    Name = "Limpar beacons antigos (GodBeacon)",
    Callback = function()
        task.spawn(function()
            local n = 0
            for _, inst in ipairs(Workspace:GetDescendants()) do
                if inst.Name == "GodBeacon" then
                    inst:Destroy()
                    n += 1
                end
            end
            print("[ESP] GodBeacons removidos: " .. n)
        end
    end,
})

MiscTab:CreateButton({
    Name = "Destruir este script (limpa tudo)",
    Callback = function()
        FullCleanup()
    end,
})

AddText(MiscTab, {
    Title = "Info",
    Content = "Atalho da UI: Right Shift. Reexecutar o script é seguro: a instância anterior é destruída automaticamente. O Roblox renderiza no máximo 31 Highlights ao mesmo tempo (deuses + chams).",
})

--============================--
-- Atalho da interface
--============================--
track(UserInputService.InputBegan:Connect(function(input, processed)
    if processed then return end
    if input.KeyCode == Enum.KeyCode.RightShift then
        pcall(function()
            if typeof(Rayfield.Toggle) == "function" then
                Rayfield:Toggle()
            end
        end)
    end
end))

-- Scan inicial (caso a config salva já venha com o God ESP ligado)
if Settings.GodsESP then
    StartGodScan()
end

print("[GodsAndPlayersESP v4] Carregado e otimizado:")
print("  • GodBeacon removido + varredura de beacons antigos ao iniciar")
print("  • Scan do mapa em segundo plano (em pedaços, nunca trava)")
print("  • Detecção por evento (DescendantAdded)")
print("  • Deuses custam ~zero FPS; jogadores quase zero sem Box/Skeleton")
print("  • Reexecutar é seguro (anti-duplicação via getgenv)")

Features & Information

Idk

Community Comments (1)

als478939als478939Sep 14, 2026

Holy Ai generated

More Scripts for Universal Scripts