So i’ve been trying to magnitude multiple parts with a simple script.
How can i do it? Any ideas?
thanks.
So i’ve been trying to magnitude multiple parts with a simple script.
How can i do it? Any ideas?
thanks.
You might wanna wrap that in a while loop in order to constantly keep checking for the magnitude.
for i, v in pairs(partsFolder:GetChildren()) do
if v:IsA("BasePart") then
if (obj.Position - v.Position).Magnitude <= 10 then
--do whatever you want
end
end
end
That’s a very broad question. If they are in a table, you can loop through them, like this:
for i, v in pairs(partsParent:GetChildren()) do
--Magnitude check to v
end
What exactly is your goal? To find the closest part, or something else?
Edit: @rokec123’s solution will run for every part within 10 studs.
Hello, thank you for your help. I tried this out and it did work correctly.
Thank you, I were trying to find the closest part, still @rokec123 solution works for me fine and is what i need right now.