All of this is a part of my pet system. Every new pet that the player opens gets a uuid. This pet is stored inside the player. The pet is also stored inside the playergui so you can see the pets you have. The pet inside the player and the pet inside the playergui both have a uuid. My goal is to set the pet’s uuid inside the PLAYERGUI to the same as the pet’s uuid inside the PLAYER. The problem is if 2 pets have the same name then both of them will have the same uuid which is not what I want.
The first for loop is for setting the values, the second for loop is for checking if the value is the same.
for i, Pet in pairs(Player.PetInventory:GetChildren()) do
if Pet.Name == newTemplate.Name then
for i2, Pet2 in ipairs(Player.PlayerGui.Inventory.Pets.ScrollingFrame:GetDescendants()) do
if Pet2.Name == "UUID" then
newTemplate.UUID.Value = Pet.Value
end
end
end
end
for i, Pet in pairs(Player.PetInventory:GetChildren()) do
if Pet.Name == newTemplate.Name then
for i2, Pet2 in ipairs(Player.PlayerGui.Inventory.Pets.ScrollingFrame:GetDescendants()) do
if Pet2.Name == "UUID" then
if Pet2.Value ~= Pet.Value then
newTemplate.UUID.Value = Pet.Value
end
end
end
end
end