Even tho this is kind of related to a previous topic I created, this is a completely different question.
An NPC should follow the player, to be exact, the player’s humanoid root part, as the player is moving around.
Which is better for performance
while task.wait(0.05) do
humanoid:MoveTo(part.position)
end
or
while task.wait(6) do --6 seconds so that moveto timeout doesnt stop the NPC
humanoid:MoveTo(part.position, part)
end
You should consider using StateChanged event to avoid unnecessary code execution while player is just standing still. Also change network ownership of the NPC to the player who is being followed.
Wouldnt changing ownership allow the client to completely exploit the NPC? And also wouldn’t that put too much of a load on client, if there are 50+ NPCs?
I mean, depending on how accurately you want the NPC to follow the player, you can always set it to nil but it might have inconsistencies in movement.
Inconsistencies are fine, I just want max performance, as there are gonna be too many NPCs