I would like to see examples of Collection Service in use

This is all super helpful, thanks to everyone for contributing to this thread.

I do understand the post by @RuizuKun_Dev though, many functions of CollectionService can be achieved by placing things in folders and doing things with them that way, but there are also some distinct advantages to using CollectionService as well!

Especially, multi-tagging objects for more complex behavior.

If I needed to create an array of parts that had 2 different tags, how would I go about that?

You can loop over the GetTagged result of one tag and do a HasTag search for the other inside that loop.

1 Like

Excellent!

BTW I cant find any mention of the HasTag method on the wiki page: CollectionService | Documentation - Roblox Creator Hub

so yeah that page might be in need of some improvement. (read edit below)

Rather than test if an object has a tag or not, is there any way to get a list of tags that an object has?

EDIT: I found it on the page, I am just not used to reading the new way the wiki is laid out, but I get it now.

CollectionService:GetTags(instance)

1 Like

thanks! I am on my way!

Its incredibale how much CollectionService can reduce the amount of code written and objects created.

I was using a script to place a bunch of ValueObjects inside a part for later use (player picks up) but now i can just use tags and when the player collects the part, i can just check its tags is GetTags and boom, generate the loot!

1 Like

why cant i just add all parts in a table instead of using collection service does collection service reduce lag?

I was looking for this :slight_smile: I thought copying tags from other studio needs to redo, but instead it will automatically saved, now I can make pre-made tag before putting to my actual game, sorry, just started scripting :slight_smile: really loved it!

since i keep seeing this, what is the difference between a function and a local function

Old thread, but this question is unanswered. I found a distinct advantage of CollectionService over tables:

CollectionService tags can be referenced by clients, but changes on the client are not pushed to the server.

A table secured on the server cannot be seen by the clients unless it is shared, updated frequently, and then validated on the back end. A tag is pushed automatically.

The natural advantage is that you can call the server when a quest tag is found, as opposed to checking every item, every click. Then, the server can quickly validate the event by checking the tag on its end.

Its faster, and more secure, as far as i can tell.

If you have any questions, we should probably start a new discussion.