:GetTagged() sometimes not working

I have some parts in my game in which i am checking if they are tagged on the client. This works literally 90% of the time, but rarely, some parts aren’t found. I know this is to do with the client loading things in later… but I thought :GetTagged() would yield until all the tagged parts are added but i guess it just gets all the tagged parts it finds at the time.

How could i get around this and ensure that the tagged parts are found? (I’ve tried game.Loaded and also disabling StreamingEnabled)

1 Like

this happens because StreamingEnabled is set to true in the workspace instance. To combat this, turn this off. But I would not recommend this because it would make the game very laggy on low-end devices. I advise you use server script instead.

I have tried this but it still occurs.

GetTagged doesn’t yield, it wouldn’t really make sense for it to yield anyway as tags can be added or removed at any point

You need to use CollectionService:GetInstanceAddedSignal(tagName) and GetInstanceRemovedSigbal(tagName). These will allow you to detect parts that received tags, replicated in with a tag, lost a tag, or replicated out with a tag

hmm, weird because I’m already using this. Maybe it’s something to do with how I’m handling it, because I have spinning parts and sometimes they don’t initially spin but when you reset character it starts spinning. Ill have a look further into it anyway.

Yep, it was my fault. I was waiting for the character to be added for some reason? I don’t know why I had that. Anyway thanks for helping out.

1 Like

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