My idea would be to raycast ahead of the player, and if there is a part in the way, only dash the distance up to that part so that the player doesn’t mash up onto it and fling.
The direction you are putting for the raycast is not relative to the character, it will always point -2 on the Z axis. You need to point the raycast the same direction that the character is. Only way I know how to do this is CFrame:ToWorldSpace()
CFrame:ToWorldSpace(Vector3) will add the Vector3 onto the CFrame in local space (factoring in rotation aswell) and return that position in world space.
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
print(hrp.CFrame.LookVector) --0, 0, -1
Multiplying by a scalar of 500 will increase the vector’s magnitude by a product of 500.