I am trying to handle knockback for an explosion, but am running into a problem.
I want to switch the knockback from using bodyvelocity to vectorforce, as bodyvelocity is deprecated and could break at any moment. The problem is that it doesn’t work.
My sad attempt at vector Force implementation:
local directionVector = (torsos.Parent.HumanoidRootPart.Position - explosion.Position).unit
local velocity = directionVector * 100
-- WHY THIS NO WORK?!!!!!!!11!! >:(
local A0 = Instance.new("Attachment")
A0.Parent = torsos.Parent.HumanoidRootPart
local vf = Instance.new("VectorForce")
vf.Parent = torsos.Parent.HumanoidRootPart
vf.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
vf.ApplyAtCenterOfMass = true
vf.Force = velocity
vf.Attachment0 = A0
game:GetService("Debris"):AddItem(vf, 0.3)
Versus my Body Velocity implementation:
local directionVector = (torsos.Parent.HumanoidRootPart.Position - explosion.Position).unit
local velocity = directionVector * 100
local bv = Instance.new("BodyVelocity")
bv.Parent = torsos.Parent.HumanoidRootPart
bv.MaxForce = Vector3.new(1e9, 1e9, 1e9)
bv.Velocity = velocity
game:GetService("Debris"):AddItem(bv, 0.3)
Am I handling the attachment wrong? Or do I need to compensate for something new in vector force?