Hows might I make a sword do some knockback to an AI enemy? I think it has something to do with CFrame but am not to sure, my sword script is this:
local enemies = game.Workspace.Enemies:GetChildren() --// All the children of the enemies folder.
for i, v in pairs(enemies) do
if v:FindFirstChild("Zombie") then --// If the model has a humanoid
wait(1)
v.HumanoidRootPart.Touched:Connect(function()--// When the sword touches the npc
script.Parent.Activated:Connect(function() --// If you click holding the sword it will damage.
v.Zombie:TakeDamage(10) --// Npc takes 10 Damage
wait(1)
end)
end)
end
end

2 comments
ok so what is the problem of this, because I can't anser you if you don't share the problem. Have you tested it?
yes, I have, this works fine but how would I make it do knockback to what the sword touches?