Using CollectionService to access something with no strict path?

Right now I’m unsure if it’s safe to use said service to quickly get an item without doing script.Parent.Parent.Parent... or workspace:FindFirstChild().

I’m about to work on a framework for a game I’m working on, and I want its contents accessible without a strict path (even if I moved them somewhere that a LocalScript can see, I don’t need to change paths in code). I’ve been eyeing on CollectionService’s GetTagged so I can get the first item.

I have one theory, though, that may make me want to avoid this method: It’s probably possible to hijack the first item “GetTagged” returns, at least on the client’s side.

Is this method safe? If not, are there any other ways to achieve this? Thanks.

Just as exposed as anything else given to the client. None of it’s going to be replicated to the server.

1 Like

I mean yeah, but even if changes are not visible to the server, would it be possible to still confuse LocalScripts?

If a LocalScript were to be run at a later time, and for reasons probably caused by an exploiter, they gave an object a tag whose name is exactly the same as my framework’s tag, that will still cause problems, no?

Use ObjectValues, and put them all under a folder under ReplicatedStorage, you can loop through them all if you really want to else give it an AttributeValue as well to specify them, change their name, have another folder inside the original folder etc.

for _, objValue in pairs(game:GetService("ReplicatedStorage"):WaitForChild("Tagged"):GetChildren()) do
   local obj = objValue:IsA("ObjectValue") and objValue.Value
   if obj then
      -- is tagged
   end
end

No reason to use object values, CollectionService does the same thing with less code. Best to stop relying on value objects.

It copies over from Server to Client. CollectionService does not in fact.
else use RemoteFunctions, request the tagged data and return it to the client.

This can still be subject to the exploiter’s ability to remove items locally, though.

An exploiter can change scripts as well, everything can be exploited on the client. You cannot stop this from happening even with CollectionService, there are ways around it. There is no real way to stop exploiters from changing the script, changing the data received etc. So stop worrying about that.

2 Likes

I did a quick test on Studio, and new and existing tags do replicate (server → all clients, not backwards)

Use RemoteEvents to send over data to the clients, though this can be exploited by exploiters as well.
There is no way around stopping exploiters.

1 Like

No, value instances are just messy. Programmers should learn to keeping data stored within their scripts as tables.

1 Like

I’ll probably have to shelf my idea of using CollectionService for now, might as well stick to remotes and strict paths instead. I’ll just use CollectionService for less important game aspects. Thanks @xZylter and @KJry_s.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.