I am not sure why it doesn't work, it has been giving me problems and I don't know what the problem is so I can't learn from my mistakes.

local timeyouahavebeenrunning = 100

RunService.RenderStepped:Connect(function()
	local maxstamina = 0
	local StartingStamina = 100
 
	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 timeyouahavebeenrunning <= maxstamina  do
				wait(0.25)
				timeyouahavebeenrunning = timeyouahavebeenrunning - 1
			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
				while humanoid.MoveDirection.Magnitude > 0 and Userinputservice:IsKeyDown(Enum.KeyCode.LeftShift) or timeyouahavebeenrunning >= StartingStamina do
					wait(0.25)
					timeyouahavebeenrunning= timeyouahavebeenrunning + 1
				end
				
				if humanoid.MoveDirection.Magnitude > 0 and Userinputservice:IsKeyDown(Enum.KeyCode.LeftShift) then
					local Debounce = true
				end

			else
						while timeyouahavebeenrunning >= StartingStamina do
				  		wait(0.25)
						timeyouahavebeenrunning = timeyouahavebeenrunning - 1
							
					end
				end
					
			end
		end
		
end)

2 comments

0

Please dont waste our time. Look through your code and eventually you will find the problem or sometimrs theres isnt a problem with your code, its a problem with Roblox. Its a very useful skill to have to see problems in your own code, i suggest you practice a bit.

0

Thanks for the feedback, I will try to fix my code.