Better way to get magnitude than using heartbeat

Im making an npc spawning system using magnitude to get the distance from player to the spawner inside of heartbeat.

The issue is that the game will have a TON of spawners like 1000+ and the script performance is reaching 10% at 500 of them. I would like to know if there are better ways to do what im currently doing to improve efficiency.

sorry if im missing some stuff, im relatively new to scripting.

why don’t just use “while” loop instead of Heartbeat?

for your system its more recommended to use while loop instead of Heartbeat, and because of the new Roblox FPS system, the Heartbeat will run differently on every device(240 FPS = 240 npc every second)

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