PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetNumAwakeParts

Returns the number of BaseParts that are deemed physically active, due to being recently under the influence of physics.

This function provides a measure of how many BaseParts are being influenced by, or recently under the influence of, physical forces.

print(workspace:GetNumAwakeParts()) -- prints the number of 'awake' parts

Sleeping vs Awake Parts

In order to ensure good performance, Roblox sets BaseParts in which physics are not being applied to a ‘sleeping’ state. BaseParts with BasePart/Anchored set to true, for example, will always be sleeping as physics does not apply to them. When a force is applied to an non anchored BasePart, an ‘awake’ state will be applied. Whilst a BasePart is awake the Roblox physics engine will perform continuous calculations to ensure physical forces interact correctly with the part. Once the BasePart is no longer subject to physical forces, it will revert to a ‘sleeping’ state.

Returns

Return Type Summary

int

The number of awake parts.