local Rayfield = loadstring(game:HttpGet('https://[Log in to view URL]'))()
local Players = game:GetService("Players")
local HttpService = game:GetService("HttpService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- 1. Setup Data References
local player = Players.LocalPlayer
local InventoryModule = require(player.PlayerScripts.Modules.Menus.Inventory.Pets)
local Replication = require(ReplicatedStorage.Game.Replication)

local Window = Rayfield:CreateWindow({
   Name = "Tap Sim Duping | NWR's Hub",
   LoadingTitle = "#TapSimDevsAreBad...",
   LoadingSubtitle = "by whoisnwr",
})

local Tab = Window:CreateTab("Duping", 4483362458) -- Tab icon ID

-- Variables for Selection
local selectedPetID = nil
local petList = {}

-- 2. Function to Refresh Pet List
local function updatePetList()
    petList = {}
    for id, data in pairs(Replication.Data.Pets) do
        -- We'll show the Pet Name and ID in the dropdown
        table.insert(petList, data.Name .. " (" .. id .. ")")
    end
    return petList
end

-- 3. The Core Duplication Logic (Your EXACT script logic)
local function runDuplication(targetID)
    local original = Replication.Data.Pets[targetID]
    if not original then return end

    local cloneData = {}
    for k, v in pairs(original) do cloneData[k] = v end

    local newID = HttpService:GenerateGUID(false)
    cloneData.Id = newID
    cloneData.Equipped = false

    -- v31 internal table sync
    local upvalues = debug.getupvalues(InventoryModule.AddPet)
    local v31_internaltable = nil
    for , v in ipairs(upvalues) do
        if type(v) == "table" and v[targetID] then
            v31_internal_table = v
            break
        end
    end

    Replication.Data.Pets[newID] = cloneData
    if v31_internal_table then
        v31_internal_table[newID] = cloneData
    end

    pcall(function()
        InventoryModule:AddPet(newID, true)
    end)

    Rayfield:Notify({
        Title = "Success!",
        Content = "Duplicated: " .. original.Name,
        Duration = 3,
        Image = 4483362458,
    })
end

-- 4. UI Elements
local Dropdown = Tab:CreateDropdown({
   Name = "Select Pet to Dupe",
   Options = updatePetList(),
   CurrentOption = {"None"},
   MultipleOptions = false,
   Callback = function(Option)
      -- Extract the ID from the string "Name (ID)"
      selectedPetID = string.match(Option[1], "%((.-)%)")
   end,
})

Tab:CreateButton({
   Name = "Duplicate Selected Pet",
   Callback = function()
      if selectedPetID then
          runDuplication(selectedPetID)
      else
          Rayfield:Notify({Title = "Error", Content = "Please select a pet first!", Duration = 3})
      end
   end,
})

Tab:CreateButton({
   Name = "Refresh Inventory List",
   Callback = function()
      Dropdown:Refresh(updatePetList(), true)
   end,
})

Tab:CreateButton({
   Name = "Reset Selection",
   Callback = function()
      selectedPetID = nil
      Dropdown:Set({"None"})
      Rayfield:Notify({Title = "Reset", Content = "Selection cleared.", Duration = 2})
   end,
})

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: