Help with BodyPosition

Hi! I made a simple dashing script using BodyPosition. The problem is when I dash into a wall, my character just flops to the ground. Here’s the script.

Char.Humanoid.JumpHeight = 0
local velo = Instance.new(“BodyPosition”,Char.HumanoidRootPart)
velo.MaxForce = Vector3.new(100000,100000,100000)
velo.D = 1000
velo.P = 40000
velo.Position = Char.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(0,0,-30)).Position
task.wait(0.5)
velo:Destroy()
Char.Humanoid.JumpHeight = 7.2

Thanks!

Hello, BodyPosition is deprecated, so it’s not recommended to use for your scripts.
https://developer.roblox.com/en-us/api-reference/class/BodyPosition
You now use AllignPosition instead of BodyPosition
https://developer.roblox.com/en-us/api-reference/class/AlignPosition

i would recommend doing a dash like this

-- look force
local force = Char.PrimaryPart.CFrame.LookVector * 50

-- up force
force += Char.PrimaryPart.CFrame.UpVector * 1

-- make the player jump 
Char.Humanoid.Jump = true

-- add the force to the velocity
Char.PrimaryPart.AssemblyLinearVelocity += force