When I jump my stamina bar goes down 10 the first jump, but every jump after the first it goes down 20 per jump. All the health stuff works, I only have issues with stamina.
Here is my code (local script):
--Variables
local playerName = game.Players.LocalPlayer.Name
local humanoid = game.Workspace:WaitForChild(playerName):WaitForChild("Humanoid")
local healthBar = script.Parent.main.Health.barFrame.bar
local staminaBar = script.Parent.main.Stamina.barFrame.bar
local stamCount = 100
local stamCountMax = 100
--Functions
local function update()
local healthDecimal = humanoid.Health / humanoid.MaxHealth
healthBar:TweenSize(UDim2.new(healthDecimal, 0, 1, 0))
end
humanoid.Jumping:Connect(function(isActive)
if stamCount > 0 then
stamCount = stamCount - 10
local stamDecimal = stamCount / stamCountMax
staminaBar:TweenSize(UDim2.new(stamDecimal, 0, 1, 0), "In", "Linear", 0.05)
end
end)
--Connects
humanoid.Changed:connect(update)

1 comment
Jumping fires again shortly when it stops jumping.