Tag duplication?

If I were to clone an object with a certain tag, would the clone also have that tag?

2 Likes

Guess I tested it wrong, forgot to parent it to workspace so make sure you do that haha.

I don’t believe you need to parent it to the workspace based on @XAXA 's example:

I think something else weird happend idk, perhaps you are not inputting the correct instance into the first parameter?

Strange. Add a part into workspace and name it ‘tagtest’ and then run this:

game.CollectionService:AddTag(workspace.tagtest, 'd')
local clone = workspace.tagtest:Clone() 
clone.Name = 'tagtest2' 
print(game.CollectionService:GetTagged('d')) -- only prints the initial instance

Versus:

game.CollectionService:AddTag(workspace.tagtest, 'd')
local clone = workspace.tagtest:Clone() 
clone.Name = 'tagtest2' 
clone.Parent  = workspace
print(game.CollectionService:GetTagged('d')) -- prints both instances

:HasTag() seems to print true on the clone though, strange.

1 Like

Oh I see the confusion, luckily the documentation talks about it:

GetTagged returns a table of objects with a given tag which are descendants of the DataModel ( game ).

Yeah only get tagged needs a parent to the workspace to work and by default it’s nil. That’s new thanks for pointing it out.

1 Like