AudioPlayer.playAudio=function(f)if not f then warn("\067\111\117\108\100 \110\111\116 \102\105\110\100 \097\117\100\105\111 \097\115\115\101\116\058 "..f)return end if not f.IsLoaded then f.Loaded:wait()end f:Play()end AudioPlayer.pauseAudio=function(f)if f.IsPlaying then AudioPlayer.reduceVolume(f,0)f:Pause()end end AudioPlayer.resumeAudio=function(f)if f.IsPaused then f:Resume()AudioPlayer.increaseVolume(f,.5)end end AudioPlayer.reduceVolume=function(f,V)for V=f.Volume,V,-0.02 do f.Volume=V wait()end end AudioPlayer.increaseVolume=function(f,V)for V=0,V,.02 do f.Volume=V wait()end end AudioPlayer.getCurrentlyPlaying=function(f)for f,V in ipairs(f)do if V.IsPlaying then return V end end end AudioPlayer.getCurrentlyPaused=function(f)for f,V in ipairs(f)do if V.IsPaused and V.TimePosition>0 then return V end end end return AudioPlayer
-- Function to play an audio asset
AudioPlayer.playAudio = function(asset)
	if not asset then
		warn("Could not find audio asset: " .. asset)
		return
	end
	if not asset.IsLoaded then
		asset.Loaded:wait()
	end
	asset:Play()
end

AudioPlayer.pauseAudio = function(asset)
	if asset.IsPlaying then
		AudioPlayer.reduceVolume(asset, 0)
		asset:Pause()
	end
end

AudioPlayer.resumeAudio = function(asset)
	if asset.IsPaused then
		asset:Resume()
		AudioPlayer.increaseVolume(asset, 0.5)
	end
end

AudioPlayer.reduceVolume = function(asset, goalVolume)
	for i = asset.Volume, goalVolume, -0.02 do
		asset.Volume = i
		wait()
	end
end

AudioPlayer.increaseVolume = function(asset, goalVolume)
	for i = 0, goalVolume, 0.02 do
		asset.Volume = i
		wait()
	end
end

AudioPlayer.getCurrentlyPlaying = function(assets)
	for _, asset in ipairs(assets) do
		if asset.IsPlaying then
			return asset
		end
	end
end

AudioPlayer.getCurrentlyPaused = function(assets)
	for _, asset in ipairs(assets) do
		if asset.IsPaused and asset.TimePosition > 0 then
			return asset
		end
	end
end

return AudioPlayer
