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
You could try using Velocity.
This makes the local player's Character move a few studs backwards:
game.Players.LocalPlayer.Character.HumanoidRootPart.Velocity = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.LookVector*-100