Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I get all of the parts within a given radius?

What I want to do is retrieve all of the parts within a given three dimensional radius in a table. For example, a large ball has a size of 500, 500, 500. I want to get any part that would be inside of the ball.

I've heard that there's a way to do this with magnitude, but how?

1 answer

wait(10) local brick = script.Parent local mofos = game.Workspace:GetChildren() local TheDit = 20 for i,v in pairs(mofos) do if v:IsA("Part") or v:IsA("WedgePart") or v:IsA("CornerWedgePart") then

if ((brick.Position - v.Position).magnitude<TheDit) then print(v) else end end end

1 comment

0

im noob dont hate

This discussion is preserved as it was. New answers, comments, and votes are closed.