From what I read in the API services and numerous prior discussions, CollectionService is a way for clients to pass information to the server without calling events. This is desirable, as I’m trying to create an aggro function that constantly checks whether the monsters can see and chase the player. “Player D just went into room 50 from room 48? Stop checking room 48, start checking room 50.” That was the plan.
I’m already tracking the players for movement, so the client is the best place to check for this stuff.
So, the client talks to server? Obviously, this is not true:
- “PLAYER” is the tag (PlayerTag), added when PlayerAdded is called. I immediately use GetTags to make sure it is there. Note “Client”
Code:
localPlayer.CharacterAdded:Connect(function(character)
CollectionService:AddTag(character, PlayerTag)
print(CollectionService:GetTags(character))
end)
- “0” is the size of the table of PLAYER tagged items on the server, monitored by heartbeat.
Code:
tagtable = CollectionService:GetTagged(“PLAYER”)
print(#tagtable)
Am I wrong, or do I need to be calling CollectionService from the server at all times? I don’t feel like any line of code did anything but what I asked it to do. I have a second tag performing identically.
The only other explanation I can think of is that GetTagged is not updating unless I call an event. It’s possible, but it’s also the more complicated explanation.