UIS.InputBegan:connect(function(v,u)if v.KeyCode==Enum.KeyCode.LeftShift and u==false then character.Humanoid.WalkSpeed=NewWalkSpeed sprinting=true while power>0 and sprinting do power=power-.03 Bar.Size=UDim2.new(power/10,0,1,0)tween:Play()wait()if power<=0 then sprinting=false character.Humanoid.WalkSpeed=NormalWalkSpeed end end end end)UIS.InputEnded:connect(function(v,u)if v.KeyCode==Enum.KeyCode.LeftShift and u==false then character.Humanoid.WalkSpeed=NormalWalkSpeed sprinting=false runninganim:Stop()while power<10 and not sprinting do power=power+.03 Bar.Size=UDim2.new(power/10,0,1,0)tween2:Play()wait()if power<=0 then character.Humanoid.WalkSpeed=NormalWalkSpeed end end end end)Humanoid.Running:Connect(function()print("\115\116\101\112 \049")if Humanoid.MoveDirection.Magnitude>0 then print("\115\116\101\112 \050")if sprinting==true then print("\099\111\109\112\108\101\116\101")runninganim:Play()end else runninganim:Stop()end end)


UIS.InputBegan:connect(function(key, gameProcessed)
	if key.KeyCode == Enum.KeyCode.LeftShift and gameProcessed == false then
		character.Humanoid.WalkSpeed = NewWalkSpeed
		sprinting = true
		while power > 0 and sprinting do
			power = power - .03
			Bar.Size = UDim2.new(power / 10, 0, 1, 0)
			--Bar.BackgroundColor3 = Bar.BackgroundColor3:lerp(Color3.fromRGB(255, 42, 42), 0.001)
			tween:Play()
			wait()
			if power <= 0 then
				sprinting = false
				character.Humanoid.WalkSpeed = NormalWalkSpeed
			end
		end
	end
end)

UIS.InputEnded:connect(function(key, gameProcessed)
	if key.KeyCode == Enum.KeyCode.LeftShift and gameProcessed == false then
		character.Humanoid.WalkSpeed = NormalWalkSpeed
		sprinting = false
		runninganim:Stop()
		while power < 10 and not sprinting do
			power = power + .03
			Bar.Size = UDim2.new(power / 10, 0, 1, 0)
			--Bar.BackgroundColor3 = Bar.BackgroundColor3:lerp(Color3.fromRGB(255, 166, 11), 0.001)
			tween2:Play()
			wait()
			if power <= 0 then
				character.Humanoid.WalkSpeed = NormalWalkSpeed
			end
		end
	end
end)

Humanoid.Running:Connect(function()
	print("step 1")
	if Humanoid.MoveDirection.Magnitude > 0 then
		print("step 2")
		if sprinting == true then
			print("complete")
			runninganim:Play()
			--while sprinting==false or Humanoid.MoveDirection.Magnitude <= 0 do
				--if runninganim ~= nil then
				--	runninganim:Stop()
				--end
				--runninganim:Stop()
				--wait()
			--end
		end
	else
		runninganim:Stop()
		end
end)