Adding tags to collection

Hey. So I have this script where on client I collect all tags and then run a loop to detect clicking on them. When I add a new object and add a tag on them via server it receives on client and adds to the collection but the loop on client does not pick it up, why is this? How would I fix this? Thanks.

local CakePickup = CollectionService:GetTagged("CakePickup")

--Insert New Cakes (Gets added on server)
	table.insert(CakePickup, part)

--Click Detector for Cake Pickups
for _, ClickDetector in pairs(CakePickup) do
     Code Here


What does your click detection code look like?

The click detection works if I put a normal cake into the workspace and play so it isnt that code, just a basic mouseclick.

Since this loop only runs when this script is initialized, any cakes added after that will not have the mouse event hooked up, even though they are in the CakePickup table.

I see that makes sense, how would I recommend I do this?

Also run the click detector code in the GetInstanceAddedSignal connection.

also why add it to a new table? just use GetTagged() instead lol
also you won’t have to clean up the table this way