Improving this code

I want to make this code as efficient as possible. But i’m not sure if lerping a part is the most CPU efficient, rather than cframing it. I wan’t 5,000 parts to run smoothly, at a stable 30 FPS while on a decent - Super PC.


Testing.rbxl (69.8 KB)

You could try tagging the NPC and use CollectionService to manage it
Altrough that prob would need OOP unless you like to task.spawn/spawn while loops, but personally i just either task.spawn a while loop and break it if the NPC no longer exists or have a loop outside of that and just use GetTagged() and update all NPCs at once

But 1 while loop in a script shouldn’t cause too much performance loss anyway, computers nowadays are fast enough to calculate that unless it’s a while loop without a wait() or task.wait()

1 Like