RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"script a image label called Stamina and it goes down when players run"
-- local script local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local staminaLabel = script.Parent.Stamina local maxStamina = 100 local currentStamina = maxStamina local running = false local function updateStamina() if running then currentStamina = currentStamina - 1 else currentStamina = math.min(currentStamina + 1, maxStamina) end staminaLabel.Size = UDim2.new(currentStamina / maxStamina, 0, 1, 0) end local function checkRunning() if humanoid.WalkSpeed > 16 then running = true else running = false end end humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(checkRunning) while true do updateStamina() wait(0.1) end