local s = Instance.new("Sound") s.Name = "BGMusic" s.SoundId = "http://www.roblox.com/asset/?id=180804241" s.Volume = 1 s.Looped = true s.archivable = false s.Parent = game.Workspace wait(0) s:play()
When I try to put music in my game, and then put other music for another spot, it plays at the same time and I can hear both of the audios for the different places at the same time. So now, I am trying to find out how to make the music just play in a certain section and in a other section it plays other music besides the other area.
Am I doing something wrong, Or is the script broken-ish?
Hello. In order to do this,you would need to use LOCAL music.You can easily do this by placing a sound inside a ScreenGUI,and adding a LocalScript to it.
Something along the lines of
local SomeSound=script.Parent.Sound game.Workspace.Area1.Touched:connect(function(h) if game.Players:GetPlayerFromCharacter(h.Parent)~=nil then SomeSound:Stop() SomeSound.SoundId="rbxassetid://183003997" wait(0.1) --For some reason,sound glitches and doesn't stop if a wait() isn't called after an ID change. SomeSound:Play() end end)
You would use an event that is fired in the server and received in the client to switch the song/sound that the local sound is playing.
If you want a 3D sound,you would need to use FilteringEnabled and add it to the Workspace from a localscript,therefore making it local to you. Parenting the sound to a brick inside the CurrentCamera might work;I am unsure of it.
Hope this information helps!
This is simple put a brick, place a sound in it, and set the MaxDistance and MinDistance, if you test it it should only play if within the set ranges
Note: you will still need to set ID and set it to play!
Hope i helped!