Best way to handle a tag system

I’m working on a game which involves tagging others. What would be the best way on handling the part where a player tags the other so it is efficient and cannot be exploited?

Example: Do I use raycasts or .touched?

Thank you.

2 Likes

There are Plenty of ways:

CollectionService can be use to indicate Tagged Players, plus, is a Provided Service usually Meant for this type of thing

Attributes can also be use as a Tag, You can create a Tag (maybe called Tagged) to use for Players, You can make it a boolean.

Tables can be used to store Players who are Tagged and who aren’t.

All can be efficient, CollectionService and Tables being very efficient.

2 Likes

I should’ve been more clear with my question, what I’m looking for is how I would handle when they get tagged. Do I use a custom hitbox or raycasts or a simple .touched event?

  • A Custom Hitbox just uses .Touched or .Magnitude, .Touched can be Inconsistent and miss Players while Magnitude is the Distance between objects, But the downside is that its more complicated to set up, you would have to iterate through all Players (preferably within an Array or Tag) and check which is the closest and which is within range

  • Rays could work, but they are limited towards a direction, if that’s what you want. They are very efficient however, and are simple to create.

1 Like

Thank you, I will probably give ray casts a try since as you mentioned, they are more efficient.

Pointing out here that this is not true. .Touched is very consistent, actually, if done from the client. If you listen from .Touched from the tagger’s client, the server will have the best experience.

2 Likes

If I do it with the client can’t it just be easily exploited?

You can check it on the server. The .Touched event is listened on the client and then it sends a remote to the server where sanity checks are performed.

1 Like

I never said that it is. I said that it can and should never be assumed that I said it in that manner.

I’ve had a 97% reliability rate with .Touched being handled on the server when touching players, they are just a bit delayed.

1 Like

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