Custom Humanoid System Help

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?

Hey, I’m no good with making custom Humanoid since im not experienced from it, however i think i have a resource that tried this before, Throwing Roblox's humanoids out the window with my custom character system: HLNE. You can learn somethings from here

Another thing i want to say is, there is another link yet again, (CCDIKController - Alternate inverse kinematics method for Motor6D rigs) This link provides another information on probably how to make a humanoid that moves

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.