When a player jumps, it sends it as the player jumping loads of times. Is there a more reliable way of checking when the player jumps?
Code:
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local staminaBar = playerGui:WaitForChild("StaminaBar"):FindFirstChild("Bar")
local humanoid = game.Players.LocalPlayer.Character.Humanoid
local debounce = false
humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
if humanoid.Jump == true then
staminaBar.Size = staminaBar.Size - UDim2.new(0.1, 0, 0, 0)
end
end)
UserInputService has an event called JumpRequest, which as the name implies, runs when the player makes a request to jump. It should work for what you want seeing as this is a localscript