I should probably explain what I mean by the title a bit more. Let’s say you have a laser gun and the main goal of the game is to shoot an NPC. But when you shoot it, it only disappears to the person who killed it but still be visible to everyone else. I don’t even know where to start to figure that out. Could you help me?
run :Destroy()
on the client of the killer.
In the client of the killer? How would I do that?
Things that are run in LocalScripts don’t replicate to the server. If you handle the kill in a LocalScript, it will only happen for the killing player.
Keep in mind, though, that this makes NPC kills “client-authoritative”, which means someone with a modified client could do things with that system they aren’t supposed to. LocalScripts in general are very vulnerable to exploiters.
You’d probably want to have your code check with the server to make sure the player is behaving like they’re supposed to if you’re basing any gameplay systems on a LocalScript-based NPC kill.
Assuming you handle the killing on a serverscript, use a remote event and FireClient
to send the killed NPC to the client and have it destroy it.