It depends what do you want to consider as area.
If the area is simply a cuboid and you define it with two 3D points then you can simply check if the character’s position is between x1 and x2, y1 and y2, z1 and z2 where point1 = (x1, y1, z1) and point2 = (x2, y2, z2).
You could add an anchored and not cancollided part in this area so it fits in whole area and make sure it will be invisible. Add a boolvalue in player and just add a script to part if player is touching a part then turn boovalue true else turn boolvalue false and then you just call boolvalue and you know if this player is in this area or not. I hope this helps.
Salut! , I would personally use a region3 defined area.
local Part = workspace.Part
local TopCorner = (Part.CFrame * CFrame.new(Part.Size.X/2, Part.Size.Y/2, Part.Size.Z/2)).p
local BottomCorner = (Part.CFrame * CFrame.new(-Part.Size.X/2, -Part.Size.Y/2, -Part.Size.Z/2)).p
local RG3 = Region3.new(TopCorner, BottomCorner)
for _, part in pairs(workspace:FindPartsInRegion3(RG3)) do
print(tostring(part))
end
Region3’s have a nice use for this as you don’t have to use parts for this, issue I find with using region3’s is that I don’t believe you can do complex shapes such as triangles unless you use multiple of them. using Parts/Region3’s are effective if you don’t want to use magnitude (which is basically like a circle instead of say a square of a rectangle).
I’ve tried using rotated Region3 modules to achieve this. What you can do is put all the player characters in a designated folder and cast the Region3 on that folder only (or put everything else in a folder and ignore that folder when casting the Region3), or else you may be casting on every single part in the game every loop, which will lag.
I usually use Region3 in order to sense weather or not a character is within a zone area that I want to check. It’s relatively easy to use but known to be a bit costly. Just be careful in the way you use it (not calling it too much).