I have an ability that spawns a huge sphere and the players inside it should experience an effect
But what’s the MOST EFFICIENT way of detecting it?
I have an ability that spawns a huge sphere and the players inside it should experience an effect
But what’s the MOST EFFICIENT way of detecting it?
Could probably use this
Alternatively, you can loop through all the players characters and check if the (CenterOfSphere - HumanoidRootPart.Position) < RADIUS, and if so then apply the effect. Dunno if this is very efficient though
Interesting, didn’t know about this function, it asks for a radius tho, how do i get the radius of the sphere i have?
Well how is the sphere created?
In the script where you will try to access the sphere, how is the sphere defined? (put the code)
I’d recommend you do:
The hitBox is the sphere zone in your case
But that requires cantouch to be on right?
Nope it can be false and it will still work
not entirely sure what u mean… but
local function DetectLocalPlayerHit(part)
workspace:GetPartBoundsInRadius(part.Position)
end
The radius of the sphere is just half the width (or height, or depth). So radius would just equal:
local Radius = Part.Size.Y/2
Note that this assumes that all dimensions are equal.
If they are not, use this instead:
local Radius = math.min(Part.Size.X Part.Size.Y, Part.Size.Z)/2
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.