Problem with BodyPosition

Hello developers, today i got a problem doing a Knockback system with BodyPosition.

this is the code:

local EndPositionOfKnockBack = TargetHRP.CFrame * CFrame.new(0,3,10)

local BodyPosition = Instance.new("BodyPosition",TargetHRP)
						
						BodyPosition.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
						BodyPosition.Position = EndPositionOfKnockBack.p
						BodyPosition.D = 100
						BodyPosition.P = 600
						
						Debris:AddItem(BodyPosition,0.5)

TargetHRP is the HumanoidRootPart from the enemy, i’m making an anime attack.

So when i use my ability, nothing happens:

It’s supposed to knockback the enemy when he looks at me, but nothing happens.
Also, there aren’t any errors in the output

I don’t see this variable in your code snippet?

Oops my bad local EndPositionOfKnockBack = TargetHRP.CFrame * CFrame.new(0,3,10)

Have you tried adjusting the Debris delay?

I assume there is more to your script? You’ve defined TargetHRP?

TargetHRP is a humanoidrootpart that i got from a touched event of the attack

From BodyPosition.TroubleShooting:

If the assembly isn’t moving, it’s likely the MaxForce is too low. Also, check for any Anchored parts within the assembly or in the way of the assembly.

Assuming you created the Dummies via Studio’s built-in Rig Builder: the HumanoidRootPart is likely Anchored as it is automatically anchored.

Thank you, it helped me a lot :slight_smile:

Hello,

BodyPosition is marked deprecated. What else do we use to move objects or make them fly if not with bodyposition?

Thanks.

Soli

This body mover has been superseded by AlignPosition . It’s highly recommended that you use AlignPosition for future work.