Remove all collection service tags from an object

I’m trying to remove all CollectionService tags from an object
I understand using :GetTags() is key but how? In a for loop? Something completely different?

for _,v in pairs(object:GetTags()) do
-- ???
end
1 Like

I’m not the best at scripting, but If your trying to get rid of something, shouldn’t you use destroy()?

I believe you can’t call :Destroy() on a CollectionService tag since it isn’t a psychical object
Using

:RemoveTag()

is how you would do it

1 Like

CollectionService:GetTags(Object) as per the API reference.

1 Like

Thank you for the correction, since the am fairly new to programming and This actually helped me!

You already have it down, but GetTags comes from CollectionService not the instance.

local CollectionService = game:GetService("CollectionService")

for _, tag in ipairs(CollectionService:GetTags(object)) do
    CollectionService:RemoveTag(object, tag)
end
5 Likes

Thanks for that! I thought I was on the right track but didn’t know the exact method. Thanks anyway!