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?
01 | RunService.RenderStepped:Connect( function () |
02 | local maxstamina = 9 |
03 | local StartingStamina = 0 |
04 |
05 | print (timeyouahavebeenrunning) |
06 | if Userinputservice:IsKeyDown(Enum.KeyCode.LeftShift) and humanoid.MoveDirection.Magnitude > 0 and Debounce = = true then |
07 |
08 |
09 | if timeyouahavebeenrunning > = maxstamina then |
10 | local Debounce = false |
11 | else |
12 | humanoid.WalkSpeed = 23 |
13 | camera.FieldOfView = 80 |
14 | RunService.RenderStepped:Connect(RunningEffect) |
15 | while wait( 1 ) do |
At lines 10, 26, 38, and 45, change "local Debounce" to "Debounce".
When you add local, it creates a local variable that only the current code block can change/read, therefore it doesn't change the Debounce used at line 6.