Area Music Player Script! [Open Source]

This is so cool! Thx bro! I like this :slight_smile:

1 Like

Hey man, wonderful script. However it seems there is a problem for me while using it. Whenever a character dies, and respawns, the music stops. It used to work just fine, but after I changed the volume in the Module Script it seemed to have messed the script up? Idrk what went wrong.
Here’s the script

1 Like

This did the trick for me, there’s a mistake in the module:

Replace the Character_Added function with:

local function Character_Added(Character)
	if (not cache[Character]) then
		cache[Character] = tick()
		Cha = Character; Hum = Cha:WaitForChild('Humanoid'); RootPart = Cha:WaitForChild("HumanoidRootPart")
		HumDied_Connection = Hum.Died:Connect(Humanoid_Died)
	end
end
3 Likes

Yep, also found out it was because I altered the respawn time from 5, to 1 second. Idk, if putting this in would fix, but at least you found something wrong, and fixed it :+1:

Thanks alot, I’d love to use this in my game!

Keep it up! Love this resource. I’m probably gonna use it in my game.

Thanks, this is very helpful! Definitely helps add some atmosphere.

Could you add a few features,

  • mute button (cant hear music)
  • multiple tracks for an area, play randomly
  • Gui on the screen that says what is playing, you can put a value in the music object that has the title and artist, if nothing is there, then it doesn’t display.

I managed to glitch it, if you use MoveTo() on character that is inside the zone, and the HumanoidRootPart is Anchored, the music still plays. Please fix

How can I make this useable with unions? I have areas that overlap and was wondering how I can work around the music going at the same time.

Here’s a script I use to have multiple tracks on in the part, I just put it into the Local Script.

local musicFolder = script.Music
local availableMusic = musicFolder:GetChildren()
local currentTrack = script.Parent.ModuleScript.Musics.Simp

if game:IsLoaded() then
	wait(5)
	while true do
		local randomTrack = availableMusic[math.random(1,#availableMusic)]
		wait(2)
		currentTrack.SoundId = randomTrack.SoundId
		currentTrack:Play()
		currentTrack.Ended:Wait()
	end
end

image

Also changed the part to pause the music instead of stopping it entirely, so that it’s

  1. a smooth transition
    and
  2. doesn’t glitch out

Hi there, I’m currently using the script for a commission, so thank you for the opportunity to use it!

Although I did encounter an issue; Sometimes the sound doesn’t play and I don’t know why it happens either. My guess is that it happens after resetting inside of the area, but I can’t be too sure.