Hi I recently heard that body velocity is deprecated, what else can I use? I need it for knockback for my combat.
Could you tell me how to use it? I am not familiar with body velocity nor that. Just an example of maybe a knockback
Everything is on the documentation link I posted in my original reply. If you still don’t understand after reading through it, I’m happy to help! I can’t at the moment because I’m very busy.
The Exact same thing as BodyVelocity
This object maintains all functionality of BodyVelocity, a legacy body mover. To instead apply a constant force, use a VectorForce object instead.
There is a couple of forum post about how to use the BodyMover:
Plus, there are Plenty of ways to Apply Knockback:
-
AssemblyLinearVelocity
(newer variant of deprecatedVelocity
thatapplysimplies force)
BasePart.Velocity = Vector3.new(number,number,number) -- deprecated
BasePart.AssemblyLinearVelocity = Vector3.new(number,number,number) -- newer varirant
-
ApplyImpulse
(Applys Force to an Object)
BasePart:ApplyImpulse(Vector3.new(number,number,number)) -- Applys Force
I can share a small snippet as an example from my code if needed. This is used to fling a player in my game by an admin command. Didn’t have much time to change it around, though:
local ply = findPlayer(plrName) --// Pretend this is your player
if ply then --// Checking if the player exists
local character = ply.Character --// Getting the character
if character then --// Checking if the character exists
local rootPart = character.HumanoidRootPart --// Getting the HumanoidRootPart
local attachment = Instance.new("Attachment") --// Creating an attachment for the LinearVelocity (THIS IS IMPORTANT!)
attachment.Name = "VelocityAttachment" --// Naming it
attachment.Parent = rootPart --// Parenting it
local velocity = Instance.new("LinearVelocity") --// Creating the LinearVelocity
velocity.Name = "FlingVelocity" --// Naming it
velocity.MaxForce = 10000 --// Setting the max force (the most amount of force that will move the character)
velocity.VectorVelocity = Vector3.new(100000, 10000, 100000) --// Setting the vector velocity (the velocity direction it will move in)
velocity.Enabled = true --// Enabling it (not necessary. It is enabled by default. I always like to make sure lol)
velocity.Attachment0 = attachment --// Setting the attachment to the one created earlier
velocity.Parent = rootPart --// Parenting it to the HumanoidRootPart
debrisService:AddItem(attachment, 0.7) --// Deletes the attachment after 0.7 seconds
debrisService:AddItem(velocity, 0.7) --// Deletes the velocity after 0.7 seconds
end
end
Sorry if this still isn’t very helpful. I’m in a rush and have a lot to do. If I’m not your solution, I don’t mind giving it to others! (Not like I did much anyways)