local Knockback = {}
function Knockback:ApplySelf(plr)
local humrp = plr.Character.HumanoidRootPart
local Attachment = Instance.new("Attachment", humrp)
local VectorForce = Instance.new("VectorForce")
VectorForce.Force = Vector3.new(0,0,-10000)
VectorForce.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
VectorForce.ApplyAtCenterOfMass = true
VectorForce.Attachment0 = Attachment
VectorForce.Parent = Attachment
game.Debris:AddItem(Attachment, 0.4)
end
return Knockback
I know it has something to do with friction or whatever, but is there a workaround? Or some other boost I can use. I tried linearvelocity but I want the boost to constantly go towards where I’m looking while it’s active.
Using a velocity controller instead of something that applies force is correct because you need to overcome the forces the character controller applies.
BodyVelocity is depreciated, but if you wanted it to go in the correct direction you would continuously set bv.Velocity to be HumanoidRootPart.CFrame.LookVector * 100 (probably using a connection to RunService.Heartbeat).
It’s easier (though not necessarily simpler) if you use a LinearVelocity. Here are some directions:
Create an attachment parented to the humanoid root part
Create a LinearVelocity
Set LinearVelocity.Attachment0 to the attachment
Run LinearVelocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
Set LinearVelocity.VectorVelocity to Vector3.new(0,0,100)
Destroy (or disable) the LinearVelocity when you want the dash to stop