Gghb

-- =========================================================
-- CONFIG WEB API
-- =========================================================
local HttpService = game:GetService("HttpService")
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")

local BASE_URL = "https://gag2petfinder.lovable.app"
local API_KEY = "2277990"

local player = Players.LocalPlayer
local PLACE_ID = game.PlaceId

local visitedServers = {}

-- =========================================================
-- HTTP WRAPPER (FIX SAFE)
-- =========================================================
local function requestHTTP(opt)

    local req = (syn and syn.request)
        or http_request
        or request

    if req then
        return req(opt)
    end
end

-- =========================================================
-- GUI (ADDED)
-- =========================================================
local gui = Instance.new("ScreenGui")
gui.Name = "PetFinderUI"
gui.Parent = player:WaitForChild("PlayerGui")

local label = Instance.new("TextLabel")
label.Size = UDim2.new(0, 300, 0, 45)
label.Position = UDim2.new(1, -310, 0, 10)
label.BackgroundColor3 = Color3.fromRGB(20,20,20)
label.TextColor3 = Color3.fromRGB(0,255,120)
label.Text = "Ready"
label.Parent = gui

-- =========================================================
-- PET SCAN (UNCHANGED)
-- =========================================================
local function getPets()

    local pets = {}
    local seen = {}

    local map = workspace:FindFirstChild("Map")
    if not map then return pets end

    local folder = map:FindFirstChild("WildPetSpawns")
    if not folder then return pets end

    for _, obj in ipairs(folder:GetDescendants()) do

        local name = obj.Name

        if string.match(name, "^WildPet_") then

            local petName =
                string.match(name, "WildPet_(.-)_WildPet")

            if petName and petName ~= "" and not seen[petName] then
                seen[petName] = true
                table.insert(pets, petName)
            end
        end
    end

    return pets
end

-- =========================================================
-- SEND TO WEB API (UNCHANGED LOGIC)
-- =========================================================
local function sendToWeb(petName)

    local payload = {
        apikey = API_KEY,
        pet_name = petName,
        player_count = #Players:GetPlayers(),

        server_link =
            "https://www.roblox.com/games/start?placeId="
            .. PLACE_ID
            .. "&launchData="
            .. game.JobId,

        job_id = game.JobId
    }

    local res = requestHTTP({
        Url = BASE_URL .. "/api/sendpostdata",
        Method = "POST",
        Headers = {
            ["Content-Type"] = "application/json",
            ["apikey"] = API_KEY
        },
        Body = HttpService:JSONEncode(payload)
    })

    if res then
        print("WEB STATUS:", res.StatusCode)
        print("WEB RESPONSE:", res.Body)
    else
        warn("NO RESPONSE FROM WEB API")
    end
end

-- =========================================================
-- SERVER HOP (ADDED)
-- =========================================================
local function getServer()

    local url =
        "https://games.roblox.com/v1/games/" ..
        PLACE_ID ..
        "/servers/Public?sortOrder=Asc&limit=50"

    local res = requestHTTP({
        Url = url,
        Method = "GET"
    })

    if not res or not res.Body then return nil end

    local data = HttpService:JSONDecode(res.Body)

    for _, server in ipairs(data.data) do

        local id = server.id

        if id ~= game.JobId
        and not visitedServers[id]
        and server.playing < server.maxPlayers then
            return id
        end
    end

    return nil
end

local function hopServer()

    label.Text = "Changing server..."

    local serverId = getServer()

    if not serverId then
        label.Text = "No server found"
        task.wait(2)
        return
    end

    visitedServers[serverId] = true

    TeleportService:TeleportToPlaceInstance(
        PLACE_ID,
        serverId,
        player
    )
end

-- =========================================================
-- MAIN EXECUTION (UNCHANGED + ADD HOP + GUI STATUS)
-- =========================================================
local function run()

    label.Text = "Scanning..."

    local pets = getPets()

    if #pets == 0 then
        sendToWeb("NO_PET_FOUND")
        label.Text = "Sent (no pet)"
        task.wait(20)
        hopServer()
        return
    end

    for _, pet in ipairs(pets) do
        sendToWeb(pet)
        task.wait(0.2)
    end

    label.Text = "Done Sent"

    task.wait(20)

    hopServer()
end

-- LOOP
task.spawn(function()
    while task.wait(5) do
        run()
    end
end)

Views: 29

Created At: 2026-06-14 02:20:13

View Raw Download Clone