What's the best way to do a King of the Hill style game?

Just like the title says, what’s the best way to do a King of the Hill script? I’ve been thinking about doing a region3, or touched and touchended events. I also read somewhere that there is a method of BasePart where you can get parts that are intersecting the given part. I just looked it up and it’s BasePart::GetTouchingParts()

I am looking for something that is performant as the server has other jobs to do. The game is on a timer, so the first team to reach the goal score wins. If the timer runs out, then the team with the highest score wins.

So which method is better?

I don’t know, are you asking for a script?

You could use a magnitude check to find the distance between a character’s HumanoidRootPart and the capture area.

if ( CaptureAreaPart.Position - HumanoidRootPart.Position ).Magnitude < 10 then

  • Guaranteed to be within the capture area.
  • Won’t interact with Touched events of moving parts.
  • Only interacts with a single part (HumanoidRootPart).

@TestingPlayer1_EP2 No script. I have no problems writing scripts. Just looking for the best method.

@Oblivic That would work for a circular area, but what about a square area? The plate can be circular, square, rectangular, oval, etc…

I suggest to look into the community module ZonePlus. It accurately detects when a player enters and leaves a zone.

Interesting. Due to security concerns, I don’t like using modules unless I wrote them myself. Besides, I think I have come up with a workable solution based on Region3 and touched events. The afore mention method GetTouchingParts doesn’t really work too well for this, so it’s one of the spatial query functions. I made the script as generic as I can, so it will look at the part it’s parented to, determine if it’s a square, rectange, circle, etc…, and adjust itself accordingly.