I had a lot of trouble getting the server to summon the NPC only for the client; the NPC wasn’t attacking because it was being controlled from the server side, but I’ve sorted that out now.
However, when I tried to attack the NPC, nothing happened. I think it’s because the tool is on the server side and the NPC is on the client side.
I did it this way because I want the NPC to be visible only to the player who summoned it and take damage only from them as well.
An Idea I have is that maybe you can make an invisible hitbox for that npc located on the server-side and have checks to make sure that only the player you want can trigger the attack. Then you can use remote functions to fire the client and damage the npc.
You need to tell the server some information about the NPC. Additionally, handling the NPC on the client requires you to give network ownership to the player, which technically means they can do anything to it. Why go through all this unnecessary work and potential security risks when you could just handle it on the server side?
bro… how did I not think of that? That would solve the visibility issue, but would other players still be able to hit it? Because it would only be invisible.
Add a whitelist check that allows only the specified player to register hits, and for the sound issue, it can be resolved the same way as the visibility issue. Just handle the sounds on the client.