So I’m working on a custom humanoid system as I plan to have a lot of NPCs, and using regular Humanoids would result in a lot of lag.
I already have animations handled on the client, but I would like some assistance on movement. I was planning to use TweenService, but my main question is how can I calculate the Y position properly? It’s on terrain so it’s a tiny bit bumpy and I want the NPC to come on top. Should position also be (somewhat) handled on the client? It is enemies so it should be synced.
I tried raycasting down, however it was done every frame and it caused massive lag with only a few NPCs. I could raycast less often but I want to explore any other idea. Does anyone have some tips on how I could do this?
Can’t you use Pathfinding Service? Here’s the tutorial from the Roblox Docs. The tutorial does use a humanoid, but you can use other parts as well, since pathfinding service just helps you find the vector waypoints to a destination.
Oh, and make sure to cache all Paths that you compute (eg. you have an NPC that goes back and forth). They’re a little expensive to create, but once you have them, it’s smooth sailing.