Iam making a combat system with sword, before i was using Body Velocity for the knockback, now since it got depreceated i dont know if i should use LinearVelocity or VectorForce for knockback, i didnt find any videos or post about it, but i tested both.
Seens like VectorForce need big numbers to work, while with VectorVelocity i just need do:
So i need multiplie with biggest numbers to have the same result, BUT LinearVelocity have some bugs like: you cant weld parts on player without set it MassLess, and the HumanoidRootPart need always be MassLess = false, i already fixed it by checking the Massless of all parts i weld on player, but i still doenst know what is better to use. (Also i make the knockback client sidedd)
Velocity is in studs per second, but Force needs to be much bigger.
Use the system that works best for you. I’ve seen posts about it before and people have used VectorForce with good results.
To my knowledge, BodyVelocity simply sets the Velocity of the assembly to a constant value.*
This code does pretty much the same thing as a BodyVelocity with an infinite force:
local RunService
local part
local velocity = humanoidRootPart.CFrame.LookVector * 20
RunService.Stepped:Connect(function()
part.Velocity = velocity
end)
LinearVelocity does the same, maintaining the same Velocity on a part or a point regardless of weight.
VectorForce is the counterpart to BodyForce.
If you didn’t need BodyForce for something like this, then clearly you don’t need VectorForce.
Velocity is mass times force.
If your thing is very lightweight, then VectorForce will send it flying.
If your thing is very heavy, then it will do nothing.
On the other hand, LinearVelocity and BodyVelocity will make it move regardless of how heavy it is.
* not really, it “applies force on a part/assembly to maintain a linear velocity” don’t nag at me
character.Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
local force = Vector3.new(0, 10, 0)
local mass = character.PrimaryPart.AssemblyMass
character.PrimaryPart:ApplyImpulse(force * mass)
sometimes i need instantly stop the player for example, and i decress the MaxForce on linear velocity with tween to make smoothie, also ApplyImpulse need disable humanoid states and its really annoying for me