Tips on how to make an Existing Pets

I’m currently creating a game, and I already have a pretty complete pet system, but I’m thinking of putting in a system where players can see how many pets of that type exist in the entire game.
I have an idea of how I would do this but I don’t know if it’s the best thing to do.
First I would create a datastore to save a table, this table would be retrieved when the server was started after that it would start updating with the function with MessagingService (It would save the table on the server where the table was changed).
but using that thought I’m sure that with a certain frequency of pets being opened on all servers some data would be lost.

you don’t need to use MessagingService, Datastore would be sufficient

when a player obtain a pet, put it in a queue for servers to only update the data once every certain amount of time

something like

local queue = {}

--player obtain pet [
if queue[petName] then
	queue[petName] += 1
else
	queue[petName] = 1
end
--]

while wait(30) do
	if next(queue) then --if queue is not empty
		--update data
	end
end

this value would be for all existing players, that is, for each save I would first have to retrieve the datastore table, add the value and then save it again?

basically, that’s what UpdateAsync is useful for