So I’m currently working on a stamina system for a game. I’m making it so that when you jump, it subtracts stamina, and when you reach below a certain point, you can no longer jump.
I’m trying to use the
Humanoid.Jumped event, but for some reason it only fires every few jumps. I’ve also tried
Humanoid.Changed, but that event fires whenever the jump button is pressed, so if you spam the button, it will drain stamina.
What’s the best method of tracking a humanoid’s jump?
if humanoid.Jump then
You can try using Humanoid.StateChanged. It is currently the best way to do it.
Here’s an example Code of how you would use it:
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local LocalCharacter = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local LocalHumanoid = LocalCharacter:WaitForChild("Humanoid")
if NewState == Enum.HumanoidStateType.Jumping then
I meant to say
Humanoid.Jumping, I’ve tried it and sometimes it won’t register. Also, because the jump input can happen at random times, I wouldn’t know what to put for a debounce.
Are you referring to “Humanoid.Jump”? That isn’t an event that’s a property which describes if the humanoid is jumping or not (via a Boolean value), instead use the “Humanoid.Jumping” event as previously suggested.