My stamina script is going haywire, and I can't find my error so I can't learn from my mistakes, Can you guys help me?
RunService.RenderStepped:Connect(function()
local maxstamina = 9
local StartingStamina = 0
print(timeyouahavebeenrunning)
if Userinputservice:IsKeyDown(Enum.KeyCode.LeftShift) and humanoid.MoveDirection.Magnitude > 0 and Debounce == true then
if timeyouahavebeenrunning >= maxstamina then
local Debounce = false
else
humanoid.WalkSpeed = 23
camera.FieldOfView = 80
RunService.RenderStepped:Connect(RunningEffect)
while wait(1) do
timeyouahavebeenrunning = timeyouahavebeenrunning + 1
if timeyouahavebeenrunning >= maxstamina then
break
end
end
end
else
if timeyouahavebeenrunning <= StartingStamina then
local Debouce = true
else
humanoid.WalkSpeed = 16
camera.FieldOfView = 70
RunService.RenderStepped:Connect(updateBobbleEffect)
if timeyouahavebeenrunning < maxstamina then
repeat
wait(1)
timeyouahavebeenrunning = timeyouahavebeenrunning - 1
until humanoid.MoveDirection.Magnitude > 0 and Userinputservice:IsKeyDown(Enum.KeyCode.LeftShift)
if humanoid.MoveDirection.Magnitude > 0 and Userinputservice:IsKeyDown(Enum.KeyCode.LeftShift) then
local Debounce = true
end
else
while wait(1) do
timeyouahavebeenrunning = timeyouahavebeenrunning - 1
if timeyouahavebeenrunning <= StartingStamina then
local Debounce = true
break
end
end
end
end
end
end)

1 comment
That did nothign