Control point capture system help

You can write your topic however you want, but you need to answer these questions:
I am trying to make a control point that is capturable like in games such as Battlefield 4 or Battlefield 1 etc. I have gotten to the point where a script detects if a player has walked onto a point and fires a RemoteEvent via the Humanoid.Touched event but I am struggling to find a way to detect when a player leaves the control point. I would use .TouchEnded but it’s extremely unreliable and sometimes fires even if I’m still in the capture area. I’m using simple blocks to define a capture area which are 30x30 in size. I’ve also tried RunService.Heartbeat and gotten to a state where it can detect when the player has left and entered reliably, the problem with it is that the event keeps firing over and over again as it’s a Heartbeat event thing and I need it to fire a RemoteEvent once a player has entered or left. Feel free to ask questions in case I haven’t explained it enough.

It would be prefered if someone could tell me the functions or methods I should be using just so I’m heading in the right direction but if you want you can provide some full-on code c:

Edit: I’m using the FindPartsInRegion3 function in the RunService.Heartbeat event.

1 Like

You can continue using the Heartbeat method, just change up the logic behind it. Keep a boolean flag that determines if a player is on the flag. Have the Heartbeat function check and set accordingly. Then if this boolean changes, fire the remote.

3 Likes

Calculate the magnitude between the character’s HumanoidRootPart and the capture point. You can use this to calculate whether the player is still in range of the capture point, meaning TouchEnded doesn’t have to be used here.

3 Likes