Scan for players system

Hello!

I am trying to create a system where you can scan for players while searching for them with your drone. When you press the “T” key for 4 seconds after the 4 seconds it would mark all the positions of players that can be seen. The problem is, I have literally no clue how to do this :sweat_smile:.

A very sketchy and simple way to do this would be to have a part extending out the front of the drone that when a player hits it marks them. However, this would not account for walls and such.

Does anyone have suggestions about how to go about this or articles for me to read?

2 Likes

Have you tried using:

Enum.KeyCode.T

?

Thats not what I’m asking. That is simply a button press, I know how to do that. I am asking how to detect the players.

Can you explain further? I am not quite sure what you mean.

There are a few ways you could do this. The most obvious way I can think of is looping through all players on the enemy team, and using Camera:WorldToScreenPoint() on their character to determine whether or not they’re in the view of the camera.

If they are in view of the camera, you could then use Camera:ViewportPointToRay() to determine if any obstacles are blocking the view from the camera.

This is assuming the player’s camera changes to the view from the drone, similar to Rainbow Six, I imagine.
Raycasting is your best bet for this. If your camera doesn’t change to the view from the drone, then the Camera functions aren’t necessary and you could just raycast to each player on the enemy team.

2 Likes