Check if player jumped from server script? (not firing)

I want to reduce the player stamina when they jump, using a server script.

This often does not fire.

humanoid.Jumping:Connect(function(isActive)
	print("Jumping: ", isActive)
end)

This is from the wiki, and this is my script:

		chr.Humanoid.Jumping:Connect(function()
			if stamina.Value > 2 then
				print('jumped')
				chr.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,true)
				stamina.Value = stamina.Value - 2
			else
				print('cant')
				chr.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,false)
			end
		end)

https://gyazo.com/10424247e51199c64252cf3ac320bfd7.gif
Not only it doesn’t fire every time, it also fires it twice.

You can :GetPropertyChangedSignal("Jump") since the Jump power of humanoids is true when they jump. Also the Jumping event fires twice because when they land the active parameter becomes false. That is what its for.

1 Like

This seems to fire it 4 times while I jump (and mid-air)
https://gyazo.com/89c2a10c12c7224ccc1e6e1f636a67e9.gif

		chr.Humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
			if stamina.Value > 2 then
				print('jumped')
				chr.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,true)
				stamina.Value = stamina.Value - 2
			else
				print('cant')
				chr.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,false)
			end
		end)

Something wrong with how I changed it?
Also don’t mind the SetState lines, they are positioned in the wrong places.

Other than those, I’d recommend the one event used to detect this, using UIS, using the event Jump Request,

also If i’m not wrong, server scripts will cause latency when doing imput kind of stuff, I really recommend using a localscript. It may be exploitable, but you can put measures to avoid that

1 Like

I tried to avoid using a local script, would’ve done so from the beginning. I’ll just go for that till I have a proper solution (or maybe it’s a bug)

Well, did jump request solve your problem?

I didn’t try it yet, i’m doing it right now
(i don’t want to bump spam this post xd)