Im making a DS style gui selection thingy for my game, and i made music for all the tabs. how would i sync it, so it transitions to the next song when i select a new tab?
(They are all the same format, speed, BPM, and length, just different versions.)
local Set = script.Setting
local Main = script.Main
local Find = script.Finder
local Dame = script["D-Name"]
local event = game.ReplicatedStorage.CwindowChanger
event.Event:Connect(function(Wind)
if Wind == "Main" then
Main:Play()
Set:Stop()
Find:Stop()
Dame:Stop()
end
if Wind == "Set" then
Set:Play()
Find:Stop()
Dame:Stop()
Main:Stop()
end
if Wind == "Find" then
Find:Play()
Main:Stop()
Set:Stop()
Dame:Stop()
end
if Wind == "Disp" then
Dame:Play()
Main:Stop()
Set:Stop()
Find:Stop()
end
if Wind == "None" then
Main:Stop()
Set:Stop()
Find:Stop()
Dame:Stop()
end
end)
For now, it justkinda starts p[laying the next one from the beginning, but i wanna know how i could make it continue from the last selected song? Like sync them all up
to get them all synced correctly you should play them all at the same time. then when you switch your screen. use the volume property to either fade between them.
oh. So I would assume they are playing on game start. in that case I would wait for all of them to be loaded before playing them. you can do this by looping through them and checking if the IsLoaded property is true
local Set = script.Setting
local Main = script.Main
local Find = script.Finder
local Dame = script["D-Name"]
local event = game.ReplicatedStorage.CwindowChanger
local Time = 0
event.Event:Connect(function(Wind)
if Wind == "Main" then
Main:Play()
Main.TimePosition = Time
Set:Stop()
Find:Stop()
Dame:Stop()
end
if Wind == "Set" then
Set:Play()
Set.TimePosition = Time
Find:Stop()
Dame:Stop()
Main:Stop()
end
if Wind == "Find" then
Find:Play()
Find.TimePosition = Time
Main:Stop()
Set:Stop()
Dame:Stop()
end
if Wind == "Disp" then
Dame:Play()
Dame.TimePosition = Time
Main:Stop()
Set:Stop()
Find:Stop()
end
if Wind == "None" then
Main:Stop()
Set:Stop()
Find:Stop()
Dame:Stop()
end
end)
local run = game:GetService("RunService")
run.Heartbeat:Connect(function()
if Main.Playing then
Time = Main.TimePosition
elseif Set.Playing then
Time = Set.TimePosition
elseif Find.Playing then
Time = Find.TimePosition
elseif Dame.Playing then
Time = Dame.TimePosition
end
end)
Only issue, when i switch theres like a second of no sound, then it cuts back to the music. any ideas to fix this?