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

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

4 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