How to convert radius to studs for GetPartsBoundInRadius

First time using GetPartsBoundInRadius and I put 15 as the radius argument while also creating a sphere with the size of Vector3.new(15,15,15).

The sphere is the size that I want yet its hitting further than it should be

Server script:


local function getParts(partType, Cframe, size, offset, overlap, visualize)
	if partType == "box" then
		local cf = Cframe * offset
		
		if visualize then
			visualizeHitBox(cf, size, Enum.PartType.Block)
		end
		
		return workspace:GetPartBoundsInBox(cf, size, overlap)
		
	else -- if its a sphere
		local cf = Cframe * offset
		
		if visualize then
			visualizeHitBox(cf, size, Enum.PartType.Ball)
		end
		
		print(size.X)
		return workspace:GetPartBoundsInRadius(cf.Position, size.X, overlap)
	end
end

– these are the important variables the others are for other stuff
offset = CFrame.new(0,0,0)
Cframe = hrp.CFrame
size = Vector3.new(15,15,15)

A radius is the diameter of the circle / 2, so you would need to use 7.5 for the radius instead of 15

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.