Need Help With NPCs

So I’ve been wanting to implement NPC’s into my fighting game for a while now, and now that I’ve finally gotten to it, I really don’t know what I’m doing. I’ve checked out some open source NPC systems but none of them really seem to work like I had intended.

In the first place, I don’t really even understand how NPC’s work. To my understanding, there isn’t much logic going on and it’s just random pathfinding, which makes it simple enough, but I don’t know how you’d even go about that. I’ve been told you can create NPC’s on the server and just have one script which handles all of them, but I’ve also been told that for better performance you can handle NPC’s on the client. But how does that even work? If you’re handling NPC’s independently on each client, how is there any kind of synchronization between clients, if each client is handling them separately. Wouldn’t client-sided NPC’s quite literally only appear on each individual client?

And then there’s the biggest issue that I’ve been trying to figure out, which is making it so that NPC’s can somehow utilize my existing combat system. I have one local script which handles all combat inputs and animations, and fires to the server using a remoteFunction. Then the server does several checks and then initiates whatever action is being called, and fires back to all clients on a separate local script I have containing all VFX. The issue is now fitting NPC’s into all of that. Since NPC’s aren’t players, they don’t have inputs. I believe I could just rewrite my local script onto a server script parented to the NPC, but that would require rewriting almost all of my code, which sounds like such a hastle, and I do really wish there is an alternative. And if that really is the only way to go about “firing” to the server through an NPC, then it was an incredibly massive oversight on my part.

If anyone has any resources that I could use for learning how NPC’s work, or how to properly implement them, or just anything regarding NPC’s at all, please let me know, because I’ve been struggling to figure this out for a while now.