How can i hit a client npc with server tool

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.

1 Like

I tried to do it, but it didn’t work, but thank you!

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?

1 Like

I am using the client so that the NPC can only be seen and take damage from the player who summoned it

Can I achieve this result if I summon it on the client side? How?

I’ve been trying for more than 3 weeks now lol

Why not just handle it on the server as usual and make it invisible, then make it visible on the client?

1 Like

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.

And would the others also hear its sound

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.

1 Like

Thank you so much! helped me a lot!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.