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

Zombie script issue?

Asked by
xHammy 0
10 years ago

I need a script that will have a zombie die when shot, or hit with a knife/sword. Is this the weapon's job, or will it require a zombie?

-Thanks

2 answers

Log in to vote
0
Answered by 10 years ago

Can be done both ways, really. That's the good thing about Lua. Quite flexible. Anyway, I recommend using a value inside the weapons, maybe titled simply 'Weapon' then using a touched method inside the zombie that finds if the value 'Weapon' exists, and if so, kills the zombie.

0
Alright, thanks! xHammy 0 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

The easiest way to do so is to use the weapon, so you don't have to work with somewhat complicated mechanics and possible Ping Lag.

All you would really have to do is check for a certain property that your zombie possesses when the bullet or sword touches it (i.e. value, name, parts, etc.)

If you were to use the zombies, you'd have to choose between putting a script inside each zombie, which isn't that practical if you're using more than, say, three zombies at once; or using ModuleScripts, edit the script, if existent, that spawns the zombie, or use a ChildAdded function to detect zombies that spawn and treat them thusly.

So, all and all, the weapon script would be the easiest way to kill the zombie.

Answer this question