<USER_REQUEST>
buatkan fiut rkayak luamor dong sript ini --[[
    ===================================================================
    UNIVERSAL EGG MONITOR, CYCLE PREDICTION, SAFE ANTI-AFK & FPS BOOST
    HOSTED ON: https://lyvaindonesia.com/egg.lua
    ===================================================================
    - BISA DIJALANKAN DI EXECUTOR (Client) MAUPUN ROBLOX STUDIO.
    - HANYA 1 SCRIPT LENGKAP (Tanpa RemoteEvent tambahan).
    - 100% AMAN DARI PERINGATAN ROBLOX (Anti-Warning / Anti-Kick):
      1. DIHAPUS: VirtualUser:CaptureController() (Bypass Idled pasif).
      2. DIHAPUS: Set3dRenderingEnabled(false) (Cegah desync engine).
      3. DIHAPUS: Modifikasi part massal & collectgarbage("collect").
    ===================================================================
]]

local HttpService = game:GetService("HttpService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local Lighting = game:GetService("Lighting")

local LocalPlayer = Players.LocalPlayer

-- ===================================================================
-- KONFIGURASI WEBHOOK DISCORD
-- ===================================================================
local WEBHOOK_SPAWN = "https://discord.com/api/webhooks/1553594275684421722/FTYXzr2UD5t8tyixmq90oC6S97_XehE2m7nyu8AO4EAnxYI85dsGrAn55_RU3x4Sk15D"
local WEBHOOK_PREDICTION = "https://discord.com/api/webhooks/1553611071728648235/o--lJLN1juauTTti2FFDVx_MO_X2ct8_c5to18sHaPLNyCUDYEYptwVFyLDODr3zdK_c"

local CONFIG = {
    NotifyCountdownBeforeReset = 60, -- Peringatan 60 detik sebelum reset
    SendStartupNotification = true,  -- Kirim panel prediksi saat script pertama kali aktif
    SendNewCycleNotification = true,  -- Kirim prediksi baru setiap siklus 5 menit dimulai
    AntiDuplicateCooldown = 20,      -- Anti spam telur yang sama (detik)
    PeriodSecondsDefault = 300,      -- 5 Menit siklus bawaan game
}

-- ===================================================================
-- 1. SISTEM ANTI-AFK AMAN (BEBAS PERINGATAN ROBLOX)
-- ===================================================================
local function setupSafeAntiAFK()
    if not LocalPlayer then return end

    task.spawn(function()
        pcall(function()
            if getconnections then
                for _, conn in ipairs(getconnections(LocalPlayer.Idled)) do
                    if conn.Disable then
                        conn:Disable()
                    elseif conn.Disconnect then
                        conn:Disconnect()
                    end
                end
                print("[Anti-AFK Aman] Listener Idled dinonaktifkan bersih via getconnections.")
                return
            end

            LocalPlayer.Idled:Connect(function()
                pcall(function()
                    local cam = Workspace.CurrentCamera
                    if cam then
                        cam.CFrame = cam.CFrame * CFrame.Angles(0, 0, 0)
                    end
                end)
            end)
            print("[Anti-AFK Aman] Fallback idled aktif tanpa VirtualUser.")
        end)
    end)
end

task.spawn(setupSafeAntiAFK)

-- ===================================================================
-- 2. SISTEM BOOST FPS AMAN (TIDAK MERUBAH MAP / TIDAK FREEZE PC)
-- ===================================================================
local isSafeBoostApplied = false

local function applySafeFPSBoost()
    if isSafeBoostApplied then return end
    isSafeBoostApplied = true

    pcall(function()
        Lighting.GlobalShadows = false
        Lighting.FogEnd = 9e9
        Lighting.FogStart = 9e9

        for _, effect in ipairs(Lighting:GetChildren()) do
            if effect:IsA("PostProcessEffect") or effect:IsA("BloomEffect") or effect:IsA("BlurEffect") or effect:IsA("SunRaysEffect") or effect:IsA("DepthOfFieldEffect") then
                effect.Enabled = false
            end
        end

        if Workspace.Terrain then
            Workspace.Terrain.WaterWaveSize = 0
            Workspace.Terrain.WaterWaveSpeed = 0
            Workspace.Terrain.WaterReflectance = 0
        end
    end)

    local mem = gcinfo and gcinfo() or 0
    print(string.format("[FPS Booster Aman] Aktif! RAM: %d KB (Ringan & Aman).", mem))
end

-- ===================================================================
-- 3. POOL TARGET TELUR LANGKA LENGKAP
-- ===================================================================
local HIGH_TIER_TARGETS = {
    -- Divine tier
    { pet = "ArchAngel", area = "Angels & Demons", rarity = "Divine", chance = 0.0200, emoji = "👑 [DIVINE]", color = 16766720 },
    { pet = "World Burner", area = "Angels & Demons", rarity = "Divine", chance = 0.0200, emoji = "👑 [DIVINE]", color = 16766720 },
    { pet = "Kitsune", area = "Cherry Blossom", rarity = "Divine", chance = 0.0200, emoji = "👑 [DIVINE]", color = 16766720 },
    { pet = "Godzilla / Nightflame", area = "Titan Temple", rarity = "Divine", chance = 0.0200, emoji = "👑 [DIVINE]", color = 16766720 },
    { pet = "Unicorn", area = "Cosmic", rarity = "Divine", chance = 0.0232, emoji = "👑 [DIVINE]", color = 16766720 },
    -- Eternal tier
    { pet = "El Maja", area = "Abyss Ocean", rarity = "Eternal", chance = 0.0889, emoji = "⚡ [ETERNAL]", color = 10181046 },
    { pet = "Phoenix", area = "Volcano", rarity = "Eternal", chance = 0.2222, emoji = "⚡ [ETERNAL]", color = 10181046 },
    { pet = "Ice Dragon", area = "Snow", rarity = "Eternal", chance = 0.2222, emoji = "⚡ [ETERNAL]", color = 10181046 },
    { pet = "Mosasaurus", area = "Prehistoric", rarity = "Eternal", chance = 0.3111, emoji = "⚡ [ETERNAL]", color = 10181046 },
    { pet = "Eternal Lunar Dragon", area = "Cosmic", rarity = "Eternal", chance = 0.3111, emoji = "⚡ [ETERNAL]", color = 10181046 },
    { pet = "Oni Tiger", area = "Cherry Blossom", rarity = "Eternal", chance = 0.3100, emoji = "⚡ [ETERNAL]", color = 10181046 },
    { pet = "King Kong", area = "Titan Temple", rarity = "Eternal", chance = 0.3100, emoji = "⚡ [ETERNAL]", color = 10181046 },
    { pet = "Pegasus", area = "Angels & Demons", rarity = "Eternal", chance = 0.3100, emoji = "⚡ [ETERNAL]", color = 10181046 },
    { pet = "Skeleton Horse", area = "Angels & Demons", rarity = "Eternal", chance = 0.3100, emoji = "⚡ [ETERNAL]", color = 10181046 },
    -- Secret tier
    { pet = "Cerberus", area = "Volcano", rarity = "Secret", chance = 0.6198, emoji = "🔮 [SECRET]", color = 16711765 },
    { pet = "TRex", area = "Prehistoric", rarity = "Secret", chance = 0.9917, emoji = "🔮 [SECRET]", color = 16711765 },
    { pet = "Tralaledon", area = "Prehistoric", rarity = "Secret", chance = 0.8265, emoji = "🔮 [SECRET]", color = 16711765 },
    { pet = "Kraken", area = "Abyss Ocean", rarity = "Secret", chance = 0.8265, emoji = "🔮 [SECRET]", color = 16711765 },
    { pet = "Pure Jellyfish", area = "Angels & Demons", rarity = "Secret", chance = 4.3600, emoji = "🔮 [SECRET]", color = 16711765 },
    { pet = "Dark Gargoyle", area = "Angels & Demons", rarity = "Secret", chance = 4.3600, emoji = "🔮 [SECRET]", color = 16711765 },
    { pet = "Cosmic Dragon", area = "Cosmic", rarity = "Secret", chance = 0.7438, emoji = "🔮 [SECRET]", color = 16711765 },
    { pet = "Stag", area = "Cherry Blossom", rarity = "Secret", chance = 0.7400, emoji = "🔮 [SECRET]", color = 16711765 },
    { pet = "Shark", area = "Titan Temple", rarity = "Secret", chance = 0.7400, emoji = "🔮 [SECRET]", color = 16711765 }
}

local RARITY_DATA = {
    ["Divine"] = { color = 16766720, hex = Color3.fromRGB(255, 215, 0), emoji = "👑 [DIVINE]" },
    ["Eternal"] = { color = 10181046, hex = Color3.fromRGB(180, 115, 255), emoji = "⚡ [ETERNAL]" },
    ["Secret"] = { color = 16711765, hex = Color3.fromRGB(255, 60, 120), emoji = "🔮 [SECRET]" },
    ["Default"] = { color = 5814783, hex = Color3.fromRGB(0, 229, 255), emoji = "✨ [RARE]" }
}

local sentHistory = {}
local webhookQueue = {}
local isProcessingQueue = false
local liveFeedList = {}
local lastNotifiedCycleIndex = -1
local last60sWarningCycleIndex = -1

-- ===================================================================
-- 4. FUNGSI PREDIKSI & HITUNG MUNDUR SIKLUS
-- ===================================================================
local function getCyclePrediction(targetCycleIndex)
    local rng = Random.new(targetCycleIndex * 19937 + 101)
    local highPool, altPool = {}, {}

    for _, t in ipairs(HIGH_TIER_TARGETS) do
        if t.rarity == "Divine" or t.rarity == "Eternal" then
            table.insert(highPool, t)
        else
            table.insert(altPool, t)
        end
    end

    return highPool[rng:NextInteger(1, #highPool)], altPool[rng:NextInteger(1, #altPool)]
end

local function getCycleState()
    local now = Workspace:GetServerTimeNow()
    local period = Workspace:GetAttribute("AreaEggCyclePeriodSeconds") or CONFIG.PeriodSecondsDefault
    local anchorAt = Workspace:GetAttribute("AreaEggCycleAnchorAt") or 0
    local anchorIdx = Workspace:GetAttribute("AreaEggCycleAnchorIndex") or 0
    local disabledAt = Workspace:GetAttribute("AreaEggCycleDisabledAt")

    local targetNow = disabledAt and math.min(now, disabledAt) or now
    local diff = targetNow - anchorAt
    local cycleIdx = math.max(0, anchorIdx + math.floor(diff / period))
    local nextResetTime = math.floor(anchorAt + (cycleIdx + 1 - anchorIdx) * period)
    local secondsRemaining = math.max(0, nextResetTime - targetNow)

    local mainTarget, altTarget = getCyclePrediction(cycleIdx + 1)

    return {
        now = math.floor(now),
        nextResetTime = nextResetTime,
        cycleIndex = cycleIdx,
        targetCycleIndex = cycleIdx + 1,
        secondsRemaining = secondsRemaining,
        minutes = math.floor(secondsRemaining / 60),
        seconds = math.floor(secondsRemaining % 60),
        period = period,
        mainTarget = mainTarget,
        altTarget = altTarget
    }
end

-- ===================================================================
-- 5. FUNGSI HTTP UNIVERSAL & QUEUE WEBHOOK
-- ===================================================================
local function sendHttpRequest(targetWebhookUrl, payloadTable)
    local jsonPayload = HttpService:JSONEncode(payloadTable)
    local reqFn = (syn and syn.request) or (http and http.request) or http_request or request or (fluxus and fluxus.request)
    
    if reqFn then
        local success, res = pcall(reqFn, {
            Url = targetWebhookUrl,
            Method = "POST",
            Headers = { ["Content-Type"] = "application/json" },
            Body = jsonPayload
        })
        if success then return true, res end
    end

    pcall(function() HttpService.HttpEnabled = true end)
    return pcall(function()
        return HttpService:RequestAsync({
            Url = targetWebhookUrl,
            Method = "POST",
            Headers = { ["Content-Type"] = "application/json" },
            Body = jsonPayload
        })
    end)
end

local function enqueueWebhook(targetUrl, payload, logTag)
    table.insert(webhookQueue, { url = targetUrl, payload = payload, tag = logTag or "Generic" })
    if not isProcessingQueue then
        isProcessingQueue = true
        task.spawn(function()
            while #webhookQueue > 0 do
                local item = table.remove(webhookQueue, 1)
                if item then
                    local s, res = sendHttpRequest(item.url, item.payload)
                    if not s then warn("[EggMonitor] Gagal kirim webhook: " .. tostring(res)) end
                    task.wait(0.7)
                end
            end
            isProcessingQueue = false
        end)
    end
end

local function buildFocusedPredictionEmbed(cycleInfo, titlePrefix)
    local nextTs = cycleInfo.nextResetTime
    local main = cycleInfo.mainTarget
    local alt = cycleInfo.altTarget

    return {
        username = "Egg Prediction System",
        avatar_url = "https://images.rbxcdn.com/f04c63289069d2f26d21e8e892d77d70.png",
        embeds = {{
            title = (titlePrefix or "🔮 PREDIKSI SIKLUS TELUR BERIKUTNYA"),
            description = string.format("### ⏳ Reset Berikutnya: <t:%d:R>\n> 🕒 **Pukul:** <t:%d:T> WIB\n> 🆔 **Menuju Siklus:** `#%d` (Durasi %d Menit)\n> 🔄 **Status:** 🟢 **Hitung Mundur Live Sync di Discord**",
                nextTs, nextTs, cycleInfo.targetCycleIndex, math.floor(cycleInfo.period / 60)),
            color = main.color or 10181046,
            fields = {
                {
                    name = "🎯 Target Prediksi Utama (Hot Pick)",
                    value = string.format("%s **%s**\n• 📍 **Lokasi / Biome:** `%s`\n• 📊 **Peluang Spawn:** `%.4f%%`\n• 💡 **Rekomendasi:** Bersiap di area **%s** sebelum hitung mundur selesai!",
                        main.emoji, main.pet, main.area, main.chance, main.area),
                    inline = false
                },
                {
                    name = "🎲 Target Prediksi Alternatif",
                    value = string.format("%s **%s**\n• 📍 **Lokasi / Biome:** `%s`\n• 📊 **Peluang Spawn:** `%.4f%%`",
                        alt.emoji, alt.pet, alt.area, alt.chance),
                    inline = false
                },
                {
                    name = "🛡️ Status Keamanan & Host",
                    value = "> • **Anti-AFK:** `Aktif (Metode Bersih Bebas Warning)`\n> • **Host:** `Dedicated (https://lyvaindonesia.com)`",
                    inline = false
                },
                {
                    name = "🚀 Teleport Cepat (Executor)",
                    value = "```lua\ngame:GetService('TeleportService'):TeleportToPlaceInstance(" .. tostring(game.PlaceId) .. ", '" .. game.JobId .. "', game.Players.LocalPlayer)\n```",
                    inline = false
                }
            },
            footer = { text = "Mencuri Sebuah Telur • lyvaindonesia.com" },
            timestamp = os.date("!%Y-%m-%dT%H:%M:%SZ")
        }}
    }
end

-- ===================================================================
-- 6. PARSER & NOTIFIKASI SAAT TELUR MUNCUL
-- ===================================================================
local function cleanString(str)
    if not str then return "" end
    str = string.gsub(str, "<[^>]+>", "")
    str = string.gsub(str, "!", "")
    return string.match(str, "^%s*(.-)%s*$")
end

local function parseEggAnnouncement(rawText)
    local clean = cleanString(rawText)
    if not clean or clean == "" then return nil end

    -- Support format Bahasa Indonesia (Roblox auto-translate) & English
    local rarity, pet, area = string.match(clean, "^([%w]+)%s+(.-)%s+[Tt]elur%s+muncul%s+di%s+(.-)$")
    if not rarity then rarity, pet, area = string.match(clean, "^A%s+([%w]+)%s+(.-)%s+Egg%s+spawned%s+in%s+(.-)$") end
    if not rarity then rarity, pet, area = string.match(clean, "^A%s+([%w]+)%s+(.-)%s+spawned%s+in%s+(.-)$") end
    if not pet then pet, area = string.match(clean, "^A%s+(.-)%s+spawned%s+in%s+(.-)$") end

    local finalRarity = nil
    if rarity then
        local rLower = string.lower(rarity)
        if rLower == "secret" then finalRarity = "Secret"
        elseif rLower == "eternal" then finalRarity = "Eternal"
        elseif rLower == "divine" then finalRarity = "Divine" end
    end

    if not finalRarity then
        local lower = string.lower(clean)
        if string.find(lower, "secret", 1, true) then finalRarity = "Secret"
        elseif string.find(lower, "eternal", 1, true) then finalRarity = "Eternal"
        elseif string.find(lower, "divine", 1, true) then finalRarity = "Divine" end
    end

    if not finalRarity then return nil end

    pet = string.gsub(pet or "Rare Egg", "%s+Egg$", "")
    area = area or "World"

    return { rarity = finalRarity, petName = pet, area = area, rawMessage = clean }
end

local updateHUDList

local function onEggDetected(parsedData)
    local petName, rarity, area = parsedData.petName, parsedData.rarity, parsedData.area
    local cacheKey = string.lower(petName) .. "_" .. string.lower(area) .. "_" .. string.lower(rarity)
    local now = tick()
    if sentHistory[cacheKey] and (now - sentHistory[cacheKey]) < CONFIG.AntiDuplicateCooldown then return end
    sentHistory[cacheKey] = now

    table.insert(liveFeedList, 1, { petName = petName, rarity = rarity, area = area })
    if #liveFeedList > 2 then table.remove(liveFeedList) end
    if updateHUDList then updateHUDList() end

    local rInfo = RARITY_DATA[rarity] or RARITY_DATA["Default"]
    local embed = {
        title = "🚨 " .. rInfo.emoji .. " EGG SPAWN DETECTED! 🚨",
        description = "Sebuah telur langka terdeteksi muncul di dalam server!\n\n> **" .. parsedData.rawMessage .. "**",
        color = rInfo.color,
        fields = {
            { name = "🥚 Nama Telur / Pet", value = "**" .. petName .. "**", inline = true },
            { name = "💎 Rarity Tier", value = "**" .. rarity .. "**", inline = true },
            { name = "📍 Lokasi / Biome", value = "**" .. area .. "**", inline = true },
            { name = "🕒 Waktu Terdeteksi", value = os.date("%H:%M:%S") .. " WIB", inline = true },
            { name = "🌐 Job ID Server", value = "`" .. (game.JobId ~= "" and game.JobId or "Live Server") .. "`", inline = true },
            { name = "🚀 Teleport Script (Client)", value = "```lua\ngame:GetService('TeleportService'):TeleportToPlaceInstance(" .. tostring(game.PlaceId) .. ", '" .. game.JobId .. "', game.Players.LocalPlayer)\n```", inline = false }
        },
        footer = { text = "Mencuri Sebuah Telur • Hosted at lyvaindonesia.com" },
        timestamp = os.date("!%Y-%m-%dT%H:%M:%SZ")
    }

    enqueueWebhook(WEBHOOK_SPAWN, {
        username = "Egg Spawn Notifier",
        avatar_url = "https://images.rbxcdn.com/f04c63289069d2f26d21e8e892d77d70.png",
        embeds = { embed }
    }, "SPAWN-" .. rarity)
end

-- ===================================================================
-- 7. SISTEM HUD ON-SCREEN LENGKAP (TIMER, TARGET, BOOST FPS, LIST)
-- ===================================================================
local updateHUDLiveTimer

local function setupHUD(targetPlayer)
    local pGui = targetPlayer:WaitForChild("PlayerGui", 15)
    if not pGui then return end

    if pGui:FindFirstChild("EggMonitorHUD") then pGui.EggMonitorHUD:Destroy() end

    local screenGui = Instance.new("ScreenGui")
    screenGui.Name = "EggMonitorHUD"
    screenGui.ResetOnSpawn = false
    screenGui.DisplayOrder = 9999
    screenGui.Parent = pGui

    local mainFrame = Instance.new("Frame")
    mainFrame.Name = "MainFrame"
    mainFrame.Size = UDim2.new(0, 275, 0, 160)
    mainFrame.Position = UDim2.new(0, 16, 0, 130)
    mainFrame.BackgroundColor3 = Color3.fromRGB(12, 16, 26)
    mainFrame.BackgroundTransparency = 0.08
    mainFrame.BorderSizePixel = 0
    mainFrame.Active = true
    mainFrame.Draggable = true
    mainFrame.Parent = screenGui

    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0, 10)
    corner.Parent = mainFrame

    local stroke = Instance.new("UIStroke")
    stroke.Color = Color3.fromRGB(0, 229, 255)
    stroke.Thickness = 1.3
    stroke.Transparency = 0.35
    stroke.Parent = mainFrame

    -- Header
    local headerRow = Instance.new("Frame")
    headerRow.Size = UDim2.new(1, -16, 0, 24)
    headerRow.Position = UDim2.new(0, 10, 0, 8)
    headerRow.BackgroundTransparency = 1
    headerRow.Parent = mainFrame

    local statusDot = Instance.new("Frame")
    statusDot.Size = UDim2.new(0, 8, 0, 8)
    statusDot.Position = UDim2.new(0, 0, 0.5, -4)
    statusDot.BackgroundColor3 = Color3.fromRGB(34, 197, 94)
    statusDot.BorderSizePixel = 0
    statusDot.Parent = headerRow
    Instance.new("UICorner", statusDot).CornerRadius = UDim.new(1, 0)

    local titleLabel = Instance.new("TextLabel")
    titleLabel.Size = UDim2.new(0, 115, 1, 0)
    titleLabel.Position = UDim2.new(0, 14, 0, 0)
    titleLabel.BackgroundTransparency = 1
    titleLabel.Text = "EGG PREDICTOR"
    titleLabel.TextColor3 = Color3.fromRGB(240, 245, 255)
    titleLabel.Font = Enum.Font.GothamBold
    titleLabel.TextSize = 11
    titleLabel.TextXAlignment = Enum.TextXAlignment.Left
    titleLabel.Parent = headerRow

    local afkBadge = Instance.new("Frame")
    afkBadge.Size = UDim2.new(0, 68, 0, 16)
    afkBadge.Position = UDim2.new(0, 134, 0.5, -8)
    afkBadge.BackgroundColor3 = Color3.fromRGB(15, 55, 30)
    afkBadge.BorderSizePixel = 0
    afkBadge.Parent = headerRow
    Instance.new("UICorner", afkBadge).CornerRadius = UDim.new(0, 4)

    local afkLabel = Instance.new("TextLabel")
    afkLabel.Size = UDim2.new(1, 0, 1, 0)
    afkLabel.BackgroundTransparency = 1
    afkLabel.Text = "🛡️ AFK AMAN"
    afkLabel.TextColor3 = Color3.fromRGB(74, 222, 128)
    afkLabel.Font = Enum.Font.GothamBold
    afkLabel.TextSize = 8.5
    afkLabel.Parent = afkBadge

    local minBtn = Instance.new("TextButton")
    minBtn.Size = UDim2.new(0, 18, 0, 18)
    minBtn.Position = UDim2.new(1, -18, 0.5, -9)
    minBtn.BackgroundColor3 = Color3.fromRGB(25, 30, 45)
    minBtn.Text = "-"
    minBtn.TextColor3 = Color3.fromRGB(180, 200, 230)
    minBtn.Font = Enum.Font.GothamBold
    minBtn.TextSize = 12
    minBtn.BorderSizePixel = 0
    minBtn.Parent = headerRow
    Instance.new("UICorner", minBtn).CornerRadius = UDim.new(0, 4)

    -- Countdown Box
    local timerBox = Instance.new("Frame")
    timerBox.Name = "TimerBox"
    timerBox.Size = UDim2.new(1, -16, 0, 22)
    timerBox.Position = UDim2.new(0, 10, 0, 34)
    timerBox.BackgroundColor3 = Color3.fromRGB(18, 24, 38)
    timerBox.BorderSizePixel = 0
    timerBox.Parent = mainFrame
    Instance.new("UICorner", timerBox).CornerRadius = UDim.new(0, 5)

    local timerText = Instance.new("TextLabel")
    timerText.Name = "TimerText"
    timerText.Size = UDim2.new(1, -10, 1, 0)
    timerText.Position = UDim2.new(0, 8, 0, 0)
    timerText.BackgroundTransparency = 1
    timerText.Text = "⏱️ Reset: Menghitung..."
    timerText.TextColor3 = Color3.fromRGB(0, 229, 255)
    timerText.Font = Enum.Font.GothamBold
    timerText.TextSize = 9.5
    timerText.TextXAlignment = Enum.TextXAlignment.Left
    timerText.Parent = timerBox

    -- Target Box
    local targetBox = Instance.new("Frame")
    targetBox.Name = "TargetBox"
    targetBox.Size = UDim2.new(1, -16, 0, 22)
    targetBox.Position = UDim2.new(0, 10, 0, 59)
    targetBox.BackgroundColor3 = Color3.fromRGB(24, 20, 36)
    targetBox.BorderSizePixel = 0
    targetBox.Parent = mainFrame
    Instance.new("UICorner", targetBox).CornerRadius = UDim.new(0, 5)

    local targetText = Instance.new("TextLabel")
    targetText.Name = "TargetText"
    targetText.Size = UDim2.new(1, -10, 1, 0)
    targetText.Position = UDim2.new(0, 8, 0, 0)
    targetText.BackgroundTransparency = 1
    targetText.Text = "🎯 Target: Memuat prediksi..."
    targetText.TextColor3 = Color3.fromRGB(255, 215, 0)
    targetText.Font = Enum.Font.GothamMedium
    targetText.TextSize = 9.5
    targetText.TextXAlignment = Enum.TextXAlignment.Left
    targetText.Parent = targetBox

    -- Boost FPS Button
    local actionRow = Instance.new("Frame")
    actionRow.Name = "ActionRow"
    actionRow.Size = UDim2.new(1, -16, 0, 20)
    actionRow.Position = UDim2.new(0, 10, 0, 84)
    actionRow.BackgroundTransparency = 1
    actionRow.Parent = mainFrame

    local boostBtn = Instance.new("TextButton")
    boostBtn.Size = UDim2.new(1, 0, 1, 0)
    boostBtn.BackgroundColor3 = Color3.fromRGB(26, 45, 65)
    boostBtn.Text = "⚡ Boost FPS Aman (Tanpa Warning / Low RAM)"
    boostBtn.TextColor3 = Color3.fromRGB(0, 229, 255)
    boostBtn.Font = Enum.Font.GothamBold
    boostBtn.TextSize = 8.5
    boostBtn.BorderSizePixel = 0
    boostBtn.Parent = actionRow
    Instance.new("UICorner", boostBtn).CornerRadius = UDim.new(0, 4)

    boostBtn.MouseButton1Click:Connect(function()
        applySafeFPSBoost()
        boostBtn.Text = "✅ FPS Dioptimasi (Aman 100%)"
        boostBtn.BackgroundColor3 = Color3.fromRGB(20, 60, 40)
        boostBtn.TextColor3 = Color3.fromRGB(74, 222, 128)
    end)

    -- Live Feed Telur
    local feedContainer = Instance.new("Frame")
    feedContainer.Name = "FeedContainer"
    feedContainer.Size = UDim2.new(1, -16, 0, 48)
    feedContainer.Position = UDim2.new(0, 10, 0, 107)
    feedContainer.BackgroundTransparency = 1
    feedContainer.Parent = mainFrame

    local listLayout = Instance.new("UIListLayout")
    listLayout.Padding = UDim.new(0, 2)
    listLayout.Parent = feedContainer

    local isMin = false
    minBtn.MouseButton1Click:Connect(function()
        isMin = not isMin
        timerBox.Visible = not isMin
        targetBox.Visible = not isMin
        actionRow.Visible = not isMin
        feedContainer.Visible = not isMin
        mainFrame.Size = isMin and UDim2.new(0, 210, 0, 36) or UDim2.new(0, 275, 0, 160)
        minBtn.Text = isMin and "+" or "-"
    end)
end

updateHUDLiveTimer = function(cycleInfo)
    local playersToUpdate = LocalPlayer and { LocalPlayer } or Players:GetPlayers()
    for _, p in ipairs(playersToUpdate) do
        local pGui = p:FindFirstChild("PlayerGui")
        local hud = pGui and pGui:FindFirstChild("EggMonitorHUD")
        if hud then
            local tBox = hud:FindFirstChild("TimerBox", true)
            local tLabel = tBox and tBox:FindFirstChild("TimerText")
            if tLabel then
                local sec = math.floor(cycleInfo.secondsRemaining)
                local timeStr = string.format("%02d:%02d", cycleInfo.minutes, cycleInfo.seconds)
                if sec <= 15 then
                    tLabel.Text = string.format("🚨 RESPAWNING... (%02ds)", sec)
                    tLabel.TextColor3 = Color3.fromRGB(255, 60, 60)
                elseif sec <= 60 then
                    tLabel.Text = string.format("⚠️ RESET DALAM: %s (%02ds)", timeStr, sec)
                    tLabel.TextColor3 = Color3.fromRGB(255, 190, 40)
                else
                    tLabel.Text = string.format("⏱️ Reset: %s (#%d) | Sync DC 🟢", timeStr, cycleInfo.targetCycleIndex)
                    tLabel.TextColor3 = Color3.fromRGB(0, 229, 255)
                end
            end

            local targetBox = hud:FindFirstChild("TargetBox", true)
            local targetText = targetBox and targetBox:FindFirstChild("TargetText")
            if targetText and cycleInfo.mainTarget then
                local m = cycleInfo.mainTarget
                targetText.Text = string.format("🎯 Target: %s (%s, %.3f%%)", m.pet, m.area, m.chance)
            end
        end
    end
end

updateHUDList = function()
    local playersToUpdate = LocalPlayer and { LocalPlayer } or Players:GetPlayers()
    for _, p in ipairs(playersToUpdate) do
        local pGui = p:FindFirstChild("PlayerGui")
        local hud = pGui and pGui:FindFirstChild("EggMonitorHUD")
        if hud then
            local container = hud:FindFirstChild("FeedContainer", true)
            if container then
                container:ClearAllChildren()
                local layout = Instance.new("UIListLayout")
                layout.Padding = UDim.new(0, 2)
                layout.Parent = container

                for idx, item in ipairs(liveFeedList) do
                    local rInfo = RARITY_DATA[item.rarity] or RARITY_DATA["Default"]
                    local row = Instance.new("TextLabel")
                    row.Size = UDim2.new(1, 0, 0, 15)
                    row.BackgroundTransparency = 1
                    row.Text = string.format("%s %s (%s)", rInfo.emoji, item.petName, item.area)
                    row.TextColor3 = rInfo.hex
                    row.Font = Enum.Font.GothamMedium
                    row.TextSize = 9
                    row.TextXAlignment = Enum.TextXAlignment.Left
                    row.Parent = container
                end
            end
        end
    end
end

-- ===================================================================
-- 8. HOOK DETEKSI TELUR LENGKAP (MULTI-SUMBER)
-- ===================================================================
pcall(function()
    TextChatService.MessageReceived:Connect(function(m)
        if m and m.Text then
            local p = parseEggAnnouncement(m.Text)
            if p then onEggDetected(p) end
        end
    end)
end)

task.spawn(function()
    local s, EggState = pcall(require, ReplicatedStorage:WaitForChild("Client", 5):WaitForChild("EggState", 5))
    if s and EggState and EggState.RarityRevealed then
        EggState.RarityRevealed:Connect(function(payload)
            if type(payload) == "table" and payload.RareSpawns then
                for _, spawn in ipairs(payload.RareSpawns) do
                    local p = parseEggAnnouncement(spawn.Message or "")
                    if p then onEggDetected(p) end
                end
            end
        end)
    end
end)

pcall(function()
    local net = ReplicatedStorage:FindFirstChild("Packages") and ReplicatedStorage.Packages:FindFirstChild("Networking")
    if net then
        local rShown = net:FindFirstChild("RE/EggWorld/FieldEggRaritiesShown")
        if rShown and rShown:IsA("RemoteEvent") then
            local function handle(payload)
                if type(payload) == "table" and payload.RareSpawns then
                    for _, spawn in ipairs(payload.RareSpawns) do
                        local p = parseEggAnnouncement(spawn.Message or "")
                        if p then onEggDetected(p) end
                    end
                end
            end
            rShown.OnClientEvent:Connect(handle)
            rShown.OnServerEvent:Connect(function(_, pl) handle(pl) end)
        end
    end
end)

task.spawn(function()
    local p = LocalPlayer or Players:GetPlayers()[1]
    if p then
        local pGui = p:WaitForChild("PlayerGui", 10)
        local notifs = pGui and pGui:WaitForChild("Notifications", 10)
        local banner = notifs and notifs:WaitForChild("Banner", 5)
        if banner then
            banner.DescendantAdded:Connect(function(d)
                if d:IsA("TextLabel") then
                    task.wait(0.05)
                    local parsed = parseEggAnnouncement(d.Text)
                    if parsed then onEggDetected(parsed) end
                end
            end)
        end
    end
end)

if LocalPlayer then
    task.spawn(setupHUD, LocalPlayer)
else
    for _, p in ipairs(Players:GetPlayers()) do task.spawn(setupHUD, p) end
    Players.PlayerAdded:Connect(setupHUD)
end

-- ===================================================================
-- 9. LOOP UTAMA PREDIKSI & TIMER SETIAP DETIK
-- ===================================================================
task.spawn(function()
    if CONFIG.SendStartupNotification then
        task.wait(1)
        enqueueWebhook(WEBHOOK_PREDICTION, buildFocusedPredictionEmbed(getCycleState(), "🔮 PREDIKSI SIKLUS BERIKUTNYA"), "STARTUP")
    end

    while true do
        local cycle = getCycleState()
        updateHUDLiveTimer(cycle)

        local sec = math.floor(cycle.secondsRemaining)
        if sec <= CONFIG.NotifyCountdownBeforeReset and sec >= (CONFIG.NotifyCountdownBeforeReset - 5) then
            if last60sWarningCycleIndex ~= cycle.cycleIndex then
                last60sWarningCycleIndex = cycle.cycleIndex
                enqueueWebhook(WEBHOOK_PREDICTION, buildFocusedPredictionEmbed(cycle, "⚠️ PERSIAPAN RESET TELUR (1 MENIT LAGI)!"), "T-60s")
            end
        end

        if lastNotifiedCycleIndex ~= cycle.cycleIndex then
            lastNotifiedCycleIndex = cycle.cycleIndex
            if CONFIG.SendNewCycleNotification and last60sWarningCycleIndex ~= -1 then
                enqueueWebhook(WEBHOOK_PREDICTION, buildFocusedPredictionEmbed(cycle, "🔄 PREDIKSI SIKLUS BARU DIMULAI"), "NEW-CYCLE")
            end
        end

        task.wait(1)
    end
end)

print("[LyvaLoader] 1 Script Lengkap Berhasil Dimuat dari https://lyvaindonesia.com/egg.lua!")  jadinnatin scrip itu jadi pendek gini bisa kna loadstring(game:HttpGet("https://lyvaindonesia.com/egg.lua"))()
