Dashing into a wall cancelling fall damage

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want when I dash into a wall not to cancel my fall damage or atleast get fall damage when u dash into a wall. I just have NO idea of how to do this. I’ve been googling looking for a solution but can’t find any.

  1. What is the issue? Include screenshots / videos if possible!

So my fall damage works, but when I dash into a wall, it stops the velocity and cancels my fall damage

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Tried setting the max force of my dash to 0.

This is my fall damage script:

local player = game.Players.LocalPlayer
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

local dofalldamageevent = game.ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("Other"):WaitForChild("DoFallDamage")

humanoid.StateChanged:Connect(function(old,new)
	
	if new ==  Enum.HumanoidStateType.Landed then
		
		print("Landed with " .. tostring(math.round(math.abs(character.HumanoidRootPart.Velocity.Y))) .. " velocity")
		
		local falldistance = math.round(math.abs(character.HumanoidRootPart.Velocity.Y))
		
		if falldistance > 100 then
			
			local damage = falldistance/5
			
			dofalldamageevent:FireServer(damage)
			
		end
		
	end
	
end)

This script works great, but when I dash into a wall it doesn’t work. This is a snippet of my dash script:

local v = Instance.new("BodyVelocity", player.Character:WaitForChild("HumanoidRootPart"))
v.MaxForce = Vector3.new(25000,300,25000)
v.Velocity = CFrame.Angles(0, math.rad(45), 0) * player.Character.HumanoidRootPart.CFrame.LookVector * 50
game.Debris:AddItem(v,0.3)

The dash script works nice too, it just doesn’t work with fall damage. Here is a clip of my issue: (don’t mind the weird ragdoll, I made that myself)

External Media

Let me know if you have any questions or if I wasn’t clear about something. Thanks!

1 Like

Dashing into the wall slows you down, so the fall damage script sees you land with a low velocity and does not fire the damage event.

1 Like

I understand why it does that. I just need a solution. I can’t think of any

1 Like

Here’s one idea I thought of - keep track of the last time the character was in the Running/climbing/swiming state, and save the Y position. Every time the character transitions from freefall to landed, get the Y position and use the difference from the previous Y position to calculate fall damage.

2 Likes

Sorry for the late reply! But I don’t think this will work when you get teleported into the sky while standing still, does it? Cause that’s probably gonna be in my game somewhere in the future

It will work so long as you get the position when the free falling state begins and ends. Free falling will begin after you teleport, so it will start at the highest point of falling. I used this in a previous game.

Thankyou, this helped! I would really like a method that makes it so dashing into a wall can atleast negate a bit of fall damage, but since that wasn’t what I asked for, thankyou! I’ll mark this as the solution

1 Like

It may be difficult to distinguish between dashing into walls and ground reliably. There are a few ways you could go about it but ultimately it depends on factors such as how the dash works and what the ground and walls consist of. To be honest, it might not be worth the effort.

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