Hi, I’m currently making a ragdoll fight game, but Idk How I can make my knockback not go in the same direction but in the direction of the punch
this is the knockack Module script :
local kb = {}
function kb.Start(character, direction)
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp == nil then return end
local att = Instance.new("Attachment", hrp)
local lv = Instance.new("LinearVelocity", att)
lv.MaxForce = 999999
lv.VectorVelocity = direction
lv.Attachment0 = att
game.Debris:AddItem(att, 0.1)
end
return kb
and the Strike Script (just the function) :
local function doDamage(player, enemyChar, hitPos, area, damage)
local eHrp, eHum = getHrpAndHumFromChar(enemyChar)
if eHrp and eHum then
local dist = (hitPos-eHrp.Position).Magnitude
if dist <= area then
eHum:TakeDamage(damage)
table.insert(db, enemyChar)
knockBack.Start(enemyChar, (enemyChar.HumanoidRootPart.Position - hitPos).Unit - Vector3.new(60, 0, 60) + Vector3.new(0, 40))
ragdoll.Start(enemyChar)
task.wait(2)
ragdoll.Stop(enemyChar)
end
end
end
Thanks you