-- Function to preload audio assets

AudioPlayer.preloadAudio = function(assetArray)
	local audioAssets = {}
 
	-- Add new "Sound" assets to "audioAssets" array
	for name, audioID in pairs(assetArray) do
		local audioInstance = Instance.new("Sound")
		audioInstance.SoundId = "rbxassetid://" .. audioID
		audioInstance.Name = name
		audioInstance.Parent = SoundService
		
		table.insert(audioAssets, audioInstance)
	end
 
	local success, assets = pcall(function()
		ContentProvider:PreloadAsync(audioAssets)
	end)
end
 