BodyVelocity causes player to fling

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
1 Like

Just try reducing the MaxForce to something that will work in most cases. Even if the Velocity you are applying is small the sudden addition of this amount of force may be causing your flinging.

bodyvelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

1 Like

alr ill try this

this is only hear because of the limit

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.