How do I stop player's character from bouncing after landing from a high height

Why can’t you use the same thing for it btw

I think I could, I just don’t how I would stop the bouncing with it.

I think you should use FreeFalling event and when it gives you false then set the VectorForce to 0 (I see this event first time so sorry if i’m wrong)

2 Likes

Wouldn’t the player still bounce with the force set to 0?

All BodyParts are attached to HumanoidRootPart so you should set HumanoidRootPart’s VectorForce to zero (I guess)

1 Like

I’ll try this, I’ll let you know if it works.

Like I expected, it’s not working.

Can you send the code that you used?

Can’t be bothered, already deleted it.

LocalScript in StarterPlayerScripts

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character and character:FindFirstChild("Humanoid")

humanoid.FreeFalling:Connect(function(bool)
    if not bool then
        -- set VectorForce
    end
end)

I tried using this which I thought should work, but didn’t seem to react fast enough to the player flinging:

humanoid.StateChanged:Connect(function(oldState, newState)
	if oldState == Enum.HumanoidStateType.Landed  and
		newState == Enum.HumanoidStateType.FallingDown then
		HRP.Anchored = true
		wait(0.1)
		HRP.Anchored = false
	end
end)

Really interested to hear if anybody has a solution to the bounce/fling problem

I still don’t understand how setting a VectorForce to 0 would stop the bouncing.

In shorter terms, you can’t.

Due to the way 3D game engines such as Roblox’s handle physics, you cannot stop bouncing using any form of Script. The only way to prevent this is to set all of the Players Body Parts to Massless = True.

However it doesn’t fully solve the problem. Falling from high heights with Massless turned on can cause other issues like the feet clipping through the terrain/part depending on width, however it doesn’t happen often and this is your best bet at achieving this effect.

You can make a script which for loops through the character when they first join the game. Falling from high heights with massless turned off* causes this bounce/fling effect, however turning on Massless for every body part in the players character object solves the issue (at least it does for me)

Just tested with a 1000 stud drop

1 Like

Sorry to bump this, however I did find a way around this issue to anyone in the future who is interested :+1:

Here’s how I solved it

local character --character, can grab from CharacterAdded signal / or placing script under character in StarterCharacter
local humanoid = character:WaitForChild("Humanoid")
local primaryPart = character:WaitForChild("HumanoidRootPart")

humanoid.StateChanged:Connect(function(oldState, newState)
	if newState.Name == "Landed" then
		-- cancel out existing velocity
		local velo = primaryPart.AssemblyLinearVelocity
		primaryPart.AssemblyLinearVelocity = velo*Vector3.new(1,0,1)

		-- get distance to ground
		local ray = Ray.new(primaryPart.Position, Vector3.new(0,-20,0))
		local hit, pos = game.Workspace:FindPartOnRay(ray, character)

		--apply ground hit position to character at hip height offset
		local hipHeight = humanoid.HipHeight
		local newPos = pos + Vector3.new(0,hipHeight,0)
		character:SetPrimaryPartCFrame(primaryPart.CFrame - primaryPart.Position + newPos)
	end
end)

The Process

For those who prefer english to lua, here’s what I did:

  1. On the client (since that needs a near instant response to look right), used the “Landed” state change humanoid signal to detect when they’re about to hit the ground
  2. Cancelled out the existing Y Axis velocity
  3. I originally thought this would be it, however apparently this event fires the frame before you’re actually contacting the ground, or possibly it bakes in your bounce position post hit. Either way, after doing this your character will stop a few meters above the ground then fall from there. To fix this, I simply immediately teleport the player to the ground
  4. To do this, I fire a raycast (admittedly using the deprecated and less performant, but also less tedious to implement, Ray.new method) that’s facing towards the ground. If anything is detected below the player within 20 units, that position is then used to teleport the player to that position, including the hip height offset so that it doesn’t get stuck in the ground.

The Result

Now to just play a superhero landing animation + cool shockwave fx :stuck_out_tongue:

Hope this helps!

22 Likes

That’s really nice. I got one question tho. What is AssemblyLinearVelocity? I tried looking many topics about this but I didn’t seem to understand the property of it and how it works? If any of you know what it is, would you mind explaining how it works?

It’s basically the old Velocity property, relabled to fit the naming terminology of the new assembly style of handling part physics. Functionally it’s a Vector3 that shows you the current part speed along each axis. I’m not sure if this behavior still works, but traditionally you could use it on anchored parts to create conveyor belts.

This look’s very good! But i’m found a glitch when you try to jump on a small object, you are teleported from that object. So i’m think i’m edited script and this glitch removed.

local character = script.Parent --character, can grab from CharacterAdded signal / or placing script under character in StarterCharacter
local humanoid = character:WaitForChild("Humanoid")
local primaryPart = character:WaitForChild("HumanoidRootPart")

humanoid.StateChanged:Connect(function(oldState, newState)
	if newState == Enum.HumanoidStateType.Landed then
		-- cancel out existing velocity
		local velo = primaryPart.AssemblyLinearVelocity
		primaryPart.AssemblyLinearVelocity = velo*Vector3.new(1,0,1)

		-- get distance to ground
		local ray = Ray.new(primaryPart.Position, Vector3.new(0,-20,0))
		local hit, pos = game.Workspace:FindPartOnRay(ray, character)

		--apply ground hit position to character at hip height offset
		local hipHeight = humanoid.HipHeight
		local newPos = pos + Vector3.new(0,hipHeight,0)
		character:MoveTo(primaryPart.Position - primaryPart.Position + newPos) -- changed to moveTo and instead of primaryPart.CFrame used primaryPart.Position
	end
end)

If you found a glitch please tell me. I’m try fix it

3 Likes
local character = script.Parent --character, can grab from CharacterAdded signal / or placing script under character in StarterCharacter
local humanoid = character:WaitForChild("Humanoid")
local primaryPart = character:WaitForChild("HumanoidRootPart")

humanoid.StateChanged:Connect(function(oldState, newState)
	if newState.Name == "Landed" then
		-- cancel out existing velocity
		local velo = primaryPart.AssemblyLinearVelocity
		primaryPart.AssemblyLinearVelocity = velo*Vector3.new(1,0,1)

		-- get distance to ground
		local ray = Ray.new(primaryPart.Position, Vector3.new(0,-20,0))
		local hit, pos = game.Workspace:FindPartOnRay(ray, character)

		--apply ground hit position to character at hip height offset
		local hipHeight = humanoid.HipHeight
		local newPos = pos + Vector3.new(0,hipHeight,0)
		character:SetPrimaryPartCFrame(primaryPart.CFrame - primaryPart.Position + newPos)
	end
end)

here ya go

2 Likes

Somebody posted this exact same script a year ago LMAO

oh damn, didnt even see it. Well I had it on hand so use it if u want