Let me go into more detail. I have the classic ROBLOX sword in StarterPack and I want to make it so it can only hit zombies but not other players. Is this possible? All help is appreciated.
you just have to add an if statement in the roblox sword that looks something like this
01 | local sword = script.Parent |
02 | --the variable of the sword |
03 | local hum = game.Players.LocalPlayer |
04 | sword.Touched:Connect( function (hit) --touched event |
05 | local zombie = --here you get the npc you have |
06 | --as an example "local part = |
07 | game.workspace |
08 | if zombie then |
09 | --take from the npc's health |
10 | end |
11 | if hum then |
12 | --take 0 hp from the player when it is hit by the sword |
13 | end |
14 | end ) |
If you found my answer helpful please consider hitting that accept answer button and hit me up if you need any more help.Have a nice day!