UserInputService.JumpRequest fires multiple times

UserInputService.JumpRequest fires multiple times.
Whenever I jump it prints 3-4 times.
How can I possibly make it only 1 time?

local uis = game:GetService("UserInputService")

uis.JumpRequest:Connect(function()
	print("Player Jumped")
end)

Thanks.

You should use Humanoid.Jumping or Humanoid.StateChanged to detect when a player jumps. I have also experienced this issue before using UserInputService.JumpRequest, but I instead used one of those 2 events.

Here is a code example for using Humanoid.Jumping:

-- Let's say your script is in 'StarterCharacterScripts'
local character = script.Parent
local humanoid = character:WaitForChidl("Humanoid")

humanoid.Jumping:Connect(function(activeState) -- 'activeState' determines if the humanoid is jumping or has stopped jumping
	if activeState then -- if activeState is true (if humanoid is jumping)
		print("Player Jumped")
	else -- if player stopped jumping (I believe)
		print("Player stopped jumping")
	end
end)

Now here is a code example for using Humanoid.StateChanged:

-- Again, let's say your script is in 'StarterCharacterScripts'
local character = script.Parent
local humanoid = character:WaitForChidl("Humanoid")

humanoid.StateChanged:Connect(function(oldState, newState) -- 'oldState' is the previous state of the humanoid before the new state, and 'newState' is the current state of the humanoid
	if newState == Enum.HumanoidStateType.Jumping then -- If humanoid is currently jumping
		print("Player Jumped")
	end
end)
6 Likes