Issues with bodyvelocity interacting with parts

Hey ya’ll! I’ve been making a rolling script so that the player can dodge in my fighting game. I have been using BodyVelocity to shoot the player forward. However, when the player bumps into a part that is too large they bounce off and go flying or glitch out. I thought that disabling the Ragdoll or FallingDown statetypes would prevent this, but this didnt seem to work consistently.

https://gyazo.com/45f196f1f169b092fc529429cbda11d9

I think that the solution is to stop the velocity if the player touches an object too large or too tall, but i cant seem to figure out how to do this. here is the part of the script that controls the velocity:

if debounce == false and locked.Value == false then
			player:SetAttribute("Stamina", player:GetAttribute("Stamina") - 60)
			debounce = true
			local BV = Instance.new("BodyVelocity")
			BV.Parent = HRP
			BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
			BV.Velocity = HRP.CFrame.lookVector*90
			roll:Play()
			wait(0.2)
			BV:Destroy()
			hum:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
			wait(1)
			debounce = false

(the rest of the script is elseifs that determine other things so ignore the missing end)

Thanks for any help in advance!

The MaxForce is way too high. Since it’s applying such high of force, it’s intended to have the player glitch or spas out.

Try making the MaxForce lower and you can mess around with the BodyVelocity’s P property for how much power is used.

What I usually use in my game is this; but it’s a little off topic because it can be different for everybody.

bv.P = 1250
bv.MaxForce = Vector3.new(400000, 400000, 400000)
4 Likes

thank you so much! this is great!

1 Like

What max force did u used like how much did u put?