Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can i make a gun only kill npc's?

Asked by 5 years ago

I'm making a game, you are supposed to kill the zombies and roleplay and stuff like that.. I don't know how to make a gun.. So i added a random gun in my game. Is there a way i can make the gun kill npc's and not the players?

0
You can set the zombie's humanoid name into something else, and change the gun's to damage that humanoid's name. Rheines 661 — 5y
0
if not game.Players:GetPlayerFromCharacter(target.Parent) then --do stuff GoldAngelInDisguise 297 — 5y
0
That fails if they hit a random wall User#24403 69 — 5y
0
if hit.Parent.Name=="zombie" then do damage. The only downside I can think of this is if the one person who is named zombie joins your game, you can also kill him. SteamG00B 1633 — 5y
View all comments (3 more)
0
if otherPart.Parent:IsA("Model") and otherPart.Parent:findFirstChild("Humanoid") and not game.Players:GetPlayerFromCharacter(otherPart.Parent) GoldAngelInDisguise 297 — 5y
1
you could also add something unique inside the zombie that a player wouldn't have and check for it GoldAngelInDisguise 297 — 5y
0
make it not work on a player Zottic 19 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

You need to make a way to make a diffrince between the npc's and the zombies. You can for example rename the Humanoid to something like Zombie. Then when the bullet hits make it check if the name is just "Humanoid" or "Zombie". You can do this using FindFirstChild

Ad

Answer this question