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
elrayocraft8:
EndPositionOfKnockBack.p
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?
RMofSBI
(RMofSBI)
April 20, 2022, 3:40am
#5
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
CodedE44OR
(CodedError)
April 20, 2022, 10:24am
#7
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
Ansaelo
(Soli)
May 2, 2022, 5:27pm
#9
Hello,
BodyPosition is marked deprecated. What else do we use to move objects or make them fly if not with bodyposition?
Thanks.
Soli
RMofSBI
(RMofSBI)
May 3, 2022, 12:19am
#10
This body mover has been superseded by AlignPosition
. It’s highly recommended that you use AlignPosition
for future work.