Detect when the player hits the ground from a custom jump

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 to make a custom jump script with a different animation

  2. What is the issue? Include screenshots / videos if possible! I need to stop the falling animation when the player touches the ground but I dont know how to do that. Humanoid states dont seem to work with a custom jump(i apply force through a script)

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Now, I know, it seems like there are plenty of similar topics, but I tried many of solutions in them, and noothing worked. I think thats because they are relying on the regular jump, and I have a custom one.

I want the player to play an animation that consists of 2 parts:

  1. Charge : before the animation event, the player just stands in place
  2. Jump : after the animation event, an upward force is applied to the player to make him jump

I made the jump part super long to cover the time spent in air, but I need to stop the animation as soon as the player touches the ground.

The animation :

The server script:

game.ReplicatedStorage.Remotes.stillJump.OnServerEvent:Connect(function(player)
	local animation = Instance.new("Animation")
	animation.AnimationId = "rbxassetid://126307006062723"
	local track = player.Character.Humanoid:LoadAnimation(animation)
	track:Play()
	track:GetMarkerReachedSignal("jump"):Connect(function()
		print("reached")
		game.ReplicatedStorage.Remotes.stillJump:FireClient(player)
	end)
end)

The local script :

game.ReplicatedStorage.Remotes.stillJump.OnClientEvent:Connect(function()
	game.Players.LocalPlayer.Character.HumanoidRootPart:ApplyImpulse(Vector3.new(0, 700, 0))
end)

Custom jumping should be client-sided

I attached a listener to the Humanoid’s state via Humanoid.StateChanged and ran your code.

So you can listen for the Landed state on the humanoid to detect when you land. This should be done on the client though, but you can test whether there are performance differences between the client and server if you wish and apply it how you need it.

I didn’t know it has to be done from a local script, thank you

Btw I’ll test it tomorrow and check if it works

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