Best way to detect a player in an hexagon shaped "storm"

Hello,

A little bit of backstory. My game includes maps that are shaped as hexagons. Players in the map fight to the death while people spectate around the map. Currently, at certain intervals, the border increases in size, hurting people in the “storm”. The border is shaped the same as the map and uses the .Touched and .TouchEnded events to detect when the player’s character is in the border.

But here is the problem. the .Touched and .TouchEnded events are very unreliable, as sometimes the .TouchEnded event would fire while the player’s humanoid root part is still in the border. Overall, .Touched should be avoided because of it relying on the player. I have tried to use alternatives that I know and I have looked up on the form, but the solutions I have tried do not work with the border shape.

Example Map:

.Magnitude

From what I saw from other form posts and the Battle Royal game Roblox released free to use, most “storms” use .Magnitude. I would see why someone would use magnitude as it is a really good way to find player’s distance from the center of the border and the player, but I cannot use the same method for my map because of its hexagonal shape (aka not spherical).

:FindPartsInRegion3

Another method is to break up the individual parts of the border and to use :FindPartsInRegion3 to find the player. The thing is, Region3 can only find parts in a “box” shape with 2 positions. My border is hexagonal, most parts would have an orientation. This method would only work for a portion of the border. This cannot work for me.

I know there is most likely way to find the player’s position using fancy math but as this is just supposed to be very simple project, I am trying to find out if there is any other options, possibly what others used.

I do not know if I am glossing over anything as I am still learning, but I was wondering if there is any other way to find the players in the border. For now, I stick to .Touched.

Please let me know if you don’t understand something or if something is inaccurate.

Unrelated

Yes, I do know I have already made this topic awhile ago, but accidentally sent a blank form. Opps!

I have deleted it right when I sent it. If there is anything I can do about it let me know. Thanks!

You could use raycasting and send a ray from the player and check whether it hits the “storm” model. I had the same problem in my game, raycasting was the solution that worked for me.

edit: make the ray length very small, or else it will hit the “storm” most of the time.

1 Like

I’ve found that using .Touched works really well when its client sided. So possibly making a startercharacter script that fires server when it touches a part with the name “Storm_border” or something like that.

Another option that I highly recommend if you want to keep this server sided. Try using Egomoose’s Rotated Region scripts. Their really good if you want to use Region3’s but hate that they’re fixed on a single rotation Rotated Region 3 Module

Thanks! I’ll keep that in mind.

Client-sided scripts could be exploited easily. An exploiter can disable a client-sided script, so it doesn’t detect when they are in the “Storm”.

Thats why I gave the second option.

Edit: by the way are raycasts pretty simple for servers to handle because I’ve always avoided them cause I wasn’t sure how laggy they could be?

1 Like

(reply to the edit)

My game doesn’t seem laggy, even though I cast rays in a while wait() loop.

1 Like

Thanks, I think I won’t use client sided scripts because of exploits and me just wanting to avoid .Touched, it’s good to know that it works well on the client. I’ll also look into Region3 Module, seems pretty interesting.