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

Putting songs 1 and 2 together in my game?

Asked by 9 years ago

I can put a song in my game, but its not the full song I need to put the other part of the song in and play it right after its over. I don't know how to put the song in order part one to part 2 with it blending in not a big space in between songs.

1 answer

Log in to vote
1
Answered by
davness 376 Moderation Voter
9 years ago

FIRST OF EVERYTHING, YOU SHOULD POST AN ATTEMPT. Altough, once it's your first time... ça va.

Assuming you have an hierarchy like this: A model (or a folder) where the two songs and the script below are.

First, you should check if the songs are not looped.

script.Parent.MusicPartA.Looped = false
script.Parent.MusicPartB.Looped = false

If this property is true, the parts will repeat individually.

Then, its time to play them:

script.Parent.MusicPartA:Play()
wait(--the time the partA lasts in seconds)
script.Parent,MusicPartB:Play()

Simple. If you want to repeat the whole music again and again, just add the while true do:

while true do
script.Parent.MusicPartA:Play()
wait(--the time the partA lasts in seconds)
script.Parent,MusicPartB:Play()
wait(--the time the partB lasts in seconds)
end

WHOLE SCRIPT:

script.Parent.MusicPartA.Looped = false
script.Parent.MusicPartB.Looped = false
while true do -- remove if you do not want to repeat
script.Parent.MusicPartA:Play()
wait(--the time the partA lasts in seconds)
script.Parent,MusicPartB:Play()
wait(--the time the partB lasts in seconds)
end -- remove if you do not want to repeat
Ad

Answer this question