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.
✓ ANSWER ACCEPTED
How do I make a sword not be able to kill players?
1 answer
✓ Accepted answer
you just have to add an if statement in the roblox sword that looks something like this
local sword = script.Parent
--the variable of the sword
local hum = game.Players.LocalPlayer
sword.Touched:Connect(function(hit)--touched event
local zombie = --here you get the npc you have
--as an example "local part =
game.workspace
if zombie then
--take from the npc's health
end
if hum then
--take 0 hp from the player when it is hit by the sword
end
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!
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
sorry i wrote it on mobile
Thanks! This works!
happy to help!