How to equip multiple pets but not equip the same pet multiple times?

I have a pet system where a player can have multiple of the same pet in their inventory. How do I make it to where they cannot equip the same exact pet they just equipped?

I have 2 folders inside the player. One for pets and one for equipped. My thinking is giving each pet a player gets in their inventory an Id using:

local HttpService = game:GetService("HttpService")
local IdResult = HttpService:GenerateGUID(true)

pet:SetAttribute("petId", IdResult)

The problem I am having is making this Id consistent with the same pet and everywhere it goes.

The ViewportFrame gets a pet model that is cloned out of ReplicatedStorage. So is there a simple way I can make my pet’s Id stay consistent?

2 Likes

you could just detect if the pet that the user wants to equip has the same name thats in the equipped folder.

example

if not petname == player.EquippedPets:FindFirstChild(petname) then -- if there is not a pet in the equipped folder that has the same name as the pet that wants to be equipped then continue
-- equip code here
end

problem with that is player can have multiple pets with the same name.