Hello,Im Doing Stamina Bar But Is Not Working SOme OnE can Help Me?
local player = game.Players.LocalPlayer local character = player.character local s = script.Parent.B local UserInputService = game:GetService("UserInputService") local stamina = 200 local running = false local jumping = false stamina = math.clamp(stamina,0,200) UserInputService.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift or Enum.KeyCode.Space then running = true character.Humanoid.WalkSpeed = 26 while stamina > 0 and running and jumping do stamina = stamina - 1 s:TweenSize(UDim2.new(stamina /200,0,1,0), "Out", "Linear", 0) wait () if stamina == 0 then character.Humanoid.WalkSpeed = 0 character.Humanoid.JumpPower = 0 end end end end) UserInputService.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift or Enum.KeyCode.Space then running = false character.Humanoid.WalkSpeed = 16 while stamina < 200 and not running and not jumping do stamina = stamina + 1 s:TweenSize(UDim2.new(stamina /200,0,1,0), "Out", "Linear", 0) wait() if stamina == 0 then character.Humanoid.WalkSpeed = 0 character.Humanoid.JumpPower = 0 end end end end)