Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Syncing background music in different areas?

Asked by 4 years ago
Edited by Ziffixture 4 years ago

Hello so for my upcoming game I've created a lot of original music for it. Since each level in the game has different zones/areas I have created a system in which the music slowly becomes more intense as the level goes on. What I mean by this is that more and more instruments/sounds are stacked on top of each other as the player progress through the level.

This is done by uploading the different parts or instruments of the track into smaller clips which then can be looped. Then as the player progresses, they will hit several triggers which then plays the music.

The system does play the sounds when you enter the areas but there is a slight problem. The music doesn't sync up with each other. The only solution I could think of is to have a timer that goes down as the loop is playing. Since the music and loops all share the same length is shouldn't be that hard in my opinion. I just haven't come up with a way to do it.

Here is the script for one of the triggers. It's pretty simple but hey it works.

function onTouched(hit)
    workspace.Music.Drums:Play()
end

script.Parent.Touched:Connect(onTouched)
0
Don’t set the Playing property to true, use the :Play() method provided by the Sound Object class. Ziffixture 6913 — 4y
0
Yeah sorry i know i about it it's just meant to demonstrate the way it works. I'll edit it racso2005 2 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

What if you paly all the parts of the song at the start, but have all but the first part with a volume of 0, then turn up the volume of the parts you want to now play with your triggers.

script.Parent.Touched:Connect(function(hit)
    workspace.Music.Drums.Volume =1
end)

You could even fade the different parts in and out!

script.Parent.Touched:Connect(function(hit)
    for Vol =0,1,0.1 do
        workspace.Music.Drums.Volume =Vol
        wait(0.05)
    end
end)
Ad

Answer this question