Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a player stop moving if the Stamina is empty?

I am trying to make a player stop running/moving if the stamina is empty.

Code I am trying to use:

local Stamina = game.Players.LocalPlayer:WaitForChild("Stats").Stamina
local StaminaMin = 0
if Stamina.Value <= StaminaMin then
	--Idk what to do here
end

If you'd help I'd be very grateful, thanks in advance.

1 answer

✓ Accepted answer
local player = game.Players.LocalPlayer
local Stamina = game.Players.LocalPlayer:WaitForChild("Stats").Stamina
local StaminaMin = 0
if Stamina.Value <= StaminaMin then
     player.Character:WaitForChild("Humanoid").WalkSpeed = 0
end

It set's the WalkSpeed to 0.

1 comment

0

Aight thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.