Hello I made an Audio GUI for my game Tower of Insanity and I noticed that when I die the audio resets. I was kind of bummed I tried looking for help in discord servers but then I used my BIG BRAIN and thought of asking you guys. If you know how to fix this please tell me ASAP thank you for your time
Code:
local MarketPlaceService = game:GetService(“MarketplaceService”)
–Song Ids
local Songs = {
4981969796,
5609469033,
1051512943,
2590490779,
152828706,
1444622447,
5450766448,
4879614820,
3749844870,
5629867848,
949399870
}
–Gui parts vars
local SongPart = script.Parent.Sound
local SongName = script.Parent.SongName
local NextButton = script.Parent.NextButton
local MuteButton = script.Parent.MuteButton
–Loop to play song
MuteButton.MouseButton1Click:Connect(function()
–song part is the sound
if SongPart.Volume == 0.5 then
SongPart.Volume = 0
else
SongPart.Volume = 0.5
end
end)
–Next song button to skip to the next song on the table
NextButton.MouseButton1Click:Connect(function()
SongPart:Stop()
end)
while true do
–getting the songs from the table
for i = 1, #Songs do
local Song = Songs[i]
local SongInfo = MarketPlaceService:GetProductInfo(Song)
--displaying the name of the song by concatonating
SongPart.SoundId = "rbxassetid://" .. Song
SongPart:Play()
SongPart.Visible = true
SongName.Text = SongInfo.Name
wait(3)
SongName.Visible = false
repeat wait() until not SongPart.IsPlaying
end
endPreformatted text