ive tried search most on youtube and find nothing but a not working sword
pls lemme know if y find an Sword that only can kill Zombies :3 thx
ive tried making the handle that damaging the Zombies only
but itsnt working
local part = script.Parent --
local Debounce = false --(Cooldown)
part.Touched:Connect(function(OtherPart)
if not OtherPart:IsDescendantOf(workspace.misc_) then
return
end
if Debounce == false then
Debounce = true --Cooldown
local Char = OtherPart:FindFirstAncestorOfClass("Model").Name = "Zombie"
local Humanoid = Char.Humanoid
Humanoid:TakeDamage(50)
task.wait()
Debounce = false
end --Debounce
end)
Your Char line is not checking for if the parent is a zombie; this script will error out. Instead, you need with an if statement to check for the name:
local part = script.Parent --
local Debounce = false --(Cooldown)
part.Touched:Connect(function(OtherPart)
if not OtherPart:IsDescendantOf(workspace.misc_) then
return
end
if Debounce == false then
Debounce = true --Cooldown
local Char = OtherPart:FindFirstAncestorOfClass("Model")
if not Char or not Char.Name == "Zombie" then
return
end
local Humanoid = Char.Humanoid
Humanoid:TakeDamage(50)
task.wait()
Debounce = false
end --Debounce
end)
Just check if the tool is activated using Tool.Activated in the touched event before you carry out the damage (note that Tool is not defined you have to set that yourself):