What’s a good alternative to the
Part.Touched event? I’m asking this because I know the
Part.Touched event isn’t very reliable, and I’ve had experience with it not working 100% of the time.
Region3 is a good option, but personally, I’ve never used
Region3 and it sounds a bit complicated. I will use it need be, but I’d rather not if there’s a simpler solution.
find parts in region.
Fully explained in the links below.
and to get direct plrs =
for _,Part in pairs(game.Workspace:FindPartsInRegion3(Region,nil,math.huge)) do
if game.Players:GetPlayerFromCharacter(Part.Parent) then
part.Touched event should be reliable if the part in question is anchored and didn’t get touched by a part that has super high velocity.
Region3 should work fine if you’re not trying to find parts with it in 60 times a second.
Another alternative is performing multiple raycasts originating from part’s origin to different angles, performing enough raycasts should be reliable enough to detect collisions for parts that are not so ridiculously small and it’s not a very expensive task to perform, unlike
Part.Touched is known to not be very reliable. For example, if someone touches a part, it wont always run.
How efficient would be using
BasePart.getTouchingParts() over a loop?
U could use magnitude [aka players in range ]
And would that be the most efficient method?
No. Iterating over players constantly and comparing their magnitude is much less efficient.
It’s fast enough you don’t need to worry though.