i have a problem that whenever i slide or dash into a wall. i get flung from the wall. I’ve tried disabling ragdolling. below ive listen the main parts where the bodyvelocity is used. Does anyone have a way to fix this
Dashing
if plrstats:FindFirstChild('Stamina').Value >= plrstats:FindFirstChild('DashStaminaCost').Value and candashberegistered == true then
candashberegistered = false
local bodyvelocity = Instance.new('BodyVelocity')
bodyvelocity.Parent = char:FindFirstChild('HumanoidRootPart')
bodyvelocity.P = 1250
bodyvelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bodyvelocity.Velocity = char:FindFirstChild('HumanoidRootPart').CFrame.lookVector*plrstats:FindFirstChild('DashPower').Value
dashanim:Play()
game.Debris:AddItem(bodyvelocity,0.15)
plrstats:FindFirstChild('Stamina').Value -= plrstats:FindFirstChild('DashStaminaCost').Value
laststamusage = tick()
task.wait(0.3)
dashanim:Stop()
task.wait(plrstats:FindFirstChild('DashCooldown').Value)
candashberegistered = true
end
Sliding
if plrstats:FindFirstChild('Stamina').Value >= plrstats:FindFirstChild('SlideStaminaCost').Value then
canslideberegistered = false
cancrouchberegistered = false
canjumpberegistered = false
hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
plrstats:FindFirstChild('Stamina').Value -= plrstats:FindFirstChild('SlideStaminaCost').Value
local bodyvelocity = Instance.new('BodyVelocity')
bodyvelocity.Parent = char:FindFirstChild('HumanoidRootPart')
bodyvelocity.P = 1250
bodyvelocity.MaxForce = Vector3.new(math.huge, 5, math.huge)
bodyvelocity.Velocity = char:FindFirstChild('HumanoidRootPart').CFrame.lookVector*plrstats:FindFirstChild('SlideStartingPower').Value
slideanim:Play()
coroutine.wrap(function()
game.Debris:AddItem(bodyvelocity,plrstats:FindFirstChild('SlideVelocityLength').Value)
for i = 1, plrstats:FindFirstChild('SlideVelocityLength').Value * 10 do
task.wait(0.1)
bodyvelocity.Velocity *= plrstats:FindFirstChild('SlideDeacceleration').Value
end
laststamusage = tick()
slideanim:Stop()
task.wait(plrstats:FindFirstChild('SlideCooldown').Value)
canslideberegistered = true
cancrouchberegistered = true
canjumpberegistered = true
hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
end)()
end