So, I have a CollectionService tag that has 4 objects.
local collectionService = game:GetService("CollectionService")
local videoFramesTag = collectionService:GetTagged("VideoFrames")
for i, v in (videoFramesTag) do
print("Hello") -- Prints 8 times
end
The issue is that it loops 8 times. Shouldn’t it loop 4 times because the tag has 4 objects?
Is the runcontext set to client? It may run inside the starterCharacterScript, then get cloned again and run twice inside a cloned local script in the player character.
Same thing if its inside starterGUi as the script gets cloned. Seen a similar problem on #help-and-feedback:scripting-support some time this week.
That’s because it is in starterCharacterScripts or StarterGui, and it ran before it was cloned, resulting in the loop running 8 times. you should probably put to starterPlayerScripts instead, if the character is not needed. The starterGui also clones it to the playerGui which is outside of playerscripts. so the localscript will run