For :GetChildren() loops vs getpartboundsinradius

so i just noticed that roblox had these getparts features for a while and i wanted to know what is more performant or are they the same

Well they are used for completely different purposes, :GetChildren() returns the direct child of an Instance, if you want to get all Children, and their Children, you can use :GetDesendants()

:GetPartBoundsInRadius() is used for checking if something is overlapping, at least According to this

1 Like

yes but for example i shoot fireball and then fireball hit, what method should i use for checking closest players nearby

Clearly not :GetChildren(), if its not a child of the Item, then what would it be used for in this case?

:GetPartBoundsInRadius() Could Potentially be used in that way, but that would most likely involve a lot of checking if something actually is touching the Projectile, which wouldn’t be very efficient.

no for example all characters are parented to a folder that only include the characters and then i use :getchildren() on that folder, in that case would that be more performant

Iterate all the characters and check if their distance from it is less than or equal to the radius of the fireball.

yes i know how to do it im asking what is more performant

Well, I told you what to do. Why would I tell you the more impreformant way to do it?

GetPartBoundsInRadius gets less performant the greater the area is tat you’re looking in. So you can just iterate over every character to see if its in range

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