I'm making a pet storage system that uses numbers to distinguish between pets of the same name. It checks the pet name using the while function in the lua block then adds the pet name to a string instance used to store the player's inventory. The problem is that it works well until there are 3 pets of the same name. Then all new pets are given the name "Pet2"
if plrpets:FindFirstChild(petresult) then
print("Replica Found")
while plrpets:FindFirstChild(petresult) do
print(int)
int +=1
petresult = petresult..tostring(int)
end
petinstance.Name = petinstance.Name..tostring(int)
int = 0
petinstance.Parent = plrpets
else
petinstance.Parent = plrpets
end
** You are now Level 2! **