CollectionService:GetTagged() not returning anything?

I’m having trouble with GetTagged not returning anything? It’s definately 100% adding the tags for my player, but when I use GetTagged in a for loop I get no results?

local function AddTag(object, tagType)
	print('Adding tag', object) -- prints Adding tag NinjoOnline
	CollectionService:AddTag(object, 'Interaction')
	CollectionService:AddTag(object, tagType)
end

local function GetTags()
	-- Get all player tags
	for _, v in pairs(Players:GetPlayers()) do
		AddTag(v, 'Player')
	end
	
	-- Get all NPC tags
	for _, v in pairs(NPCs:GetChildren()) do
		AddTag(v, 'NPC')
	end
	
	-- Get all pet tags
	for _, v in pairs(PetHolder:GetChildren()) do
		AddTag(v, 'Pet')
	end
end

local function Render()
	local Character = Player.Character
	if not Character then return end
	print('Loop') -- prints
	for _, v in pairs(CollectionService:GetTagged('Interaction')) do
		print(v) -- Nothing prints
	end		
end

GetTags()

RunService.RenderStepped:Connect(Render)

Is this a LocalScript or a Script?

Local
30 characters30 characters30 characters

It works for me. Did you make sure that there isn’t an issue with if not Character then return end? Or maybe things are not loaded in when you tag them?

I and others are experiencing similar problems. https://devforum.roblox.com/t/collectionservice-gettagged-not-working/736737/9All my scripts that were using previously created tags still work as intended. However, If I create any new tags, assign them to the same parts, and call them in a for loop in the same script, nothing is returned. This problem just started over the last few days. The tags I created prior to that are still working

I haven’t changed anything in the (Local) scripts except the name of the tag I just created.

The only thing that I am doing differently than NinjoOnline is that I’m using the Tag Editor plugin (which I’ve always used) to create the tags.

This leads me to believe there’s a problem somewhere within CollectionService:GetTagged.

for _, candy in pairs (CollectionService:GetTagged("candy1")) do
print('Touched', candy) -- Nothing Prints
candy.Touched:Connect(function(hit)
local function AddTag(object, tagType)
	print(object, tagType) -- NinjoOnline Player
	CollectionService:AddTag(object, 'Interaction')
	CollectionService:AddTag(object, tagType)
end

for _, v in pairs(Players:GetPlayers()) do
		print("Adding player tag to", v) -- Adding player tag to NinjoOnline
		AddTag(v, 'Player')
	end

local Tags = CollectionService:GetTags(object)
	print("All tags", Tags) -- All tags table: 0x1d7fe765af046a1e
	-- Find the specific tag
	local Tag
	for i, v in pairs(Tags) do
		print(i, v) -- nothing is printed here
		if v ~= 'Interaction' then
			print(Tag)
			print(v)
			Tag = v
		end
	end

FYI this actually was a bug. https://devforum.roblox.com/t/collectionservice-gettagged-not-working/736737/10?u=nexdimension4