BodyVelocity makes player fly

Would anyone know how to fix this BodyVelocity problem?

> 			local Speed = 40
> 			local Force = 50000
> 
> 			local TotalForce = Force
> 			
> 			local BodyVelocity = Instance.new("BodyVelocity", enemyHrp)
> 			
> 			BodyVelocity.MaxForce = Vector3.new(TotalForce,0,TotalForce)
> 			BodyVelocity.Velocity = humRp.CFrame.LookVector * Speed

Unfortunately, I can’t help you if you do not provide the code. Keep this in mind for future posts. Thanks!

Oh yeah I completely forgot, added them in

Why create TotalForce variable if you are setting it to the same value as Force.

Yeah I know it’s a useless variable, just too lazy to remove it (At least not until this issue is fixed)

all good. After looking at the code I can’t find anything wrong with it. I think this is because the model is unanchored. Although, I am a bit rusty as I haven’t coded in around half a year, so take my words with a grain of salt xd

Additionally, if anchoring the model doesn’t fix it, try and set the y value of the .MaxForce to -1 or lower.

Ah, apparently it was my BodyGyro :frowning_face:

local Gyro = Instance.new("BodyGyro",enemyHrp)
			Gyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
			Gyro.D = 100
			Gyro.P = 10000
			Gyro.CFrame = CFrame.new(enemyHrp.Position, enemyHrp.Position + Vector3.new(-(humRp.CFrame.LookVector.X),0,-(humRp.CFrame.LookVector.Z)))

So this post is solved, if you have any alternatives to using BodyGyro, I’d love it (So the enemy faces the player while they’re being knockedback). Thanks though!

1 Like