--------------------------------------------------------------------------------------------------------------



local sprinting = false


local function sprint(name, IS, context)
	if IS == Enum.UserInputState.Begin then
		runSound.PlaybackSpeed = 4 -- Changes the playback speed that the running sound plays at during sprinting, replace 4 with your desired playback speed if wanted
		char.Humanoid.WalkSpeed = 32
		-- Sets player speed to 32, replace 32 with your desired speed if wanted
		sprinting = true
		while stamPower > 0 and sprinting == true do
			stamPower = stamPower - stamTick
			bar.Size = UDim2.new(stamPower / 100, 0, 1, 0)
			BigFOV:Play()
			wait()
			if stamPower <= 0 then
				runSound.PlaybackSpeed = 2
				char.Humanoid.WalkSpeed = 16
				SmallFOV:Play()
			end
		end
	elseif IS == Enum.UserInputState.End then
		runSound.PlaybackSpeed = 2 -- Resets the playback speed to its original value, recommended to leave as is
		char.Humanoid.WalkSpeed = 16 -- Sets player speed to 16 (Roblox game default), if you change your Roblox game's default player speed, replace 16 with the new value
		sprinting = false
		while stamPower <= 100 and sprinting == false do
			stamPower = stamPower + regenTick
			if stamPower > 100 then
				stamPower = 100
			end
			bar.Size = UDim2.new(stamPower / 100, 0, 1, 0)
			SmallFOV:Play()
			wait()
		end
	end
end

