You can write your topic however you want, but you need to answer these questions:
-
Want to fix a bug, with my music player Keep it simple and clear!
-
What happens is songs do not play after the first one, and song requests do not work. Include screenshots / videos if possible!
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Tried adding waiting for loading, that didn’t work, looked for solutions elsewhere on the internet, that didn’t work, here’s my code, please help.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local soundtable = {5160230627,4734983736}
local songrequesttable = {}
local sound = Instance.new("Sound",game.Workspace)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local SongChange = ReplicatedStorage.SongChange
sound.Looped = false
while #songrequesttable == 0 do
for i,v in pairs(soundtable) do
sound.SoundId = "rbxassetid://" .. v
if not sound.IsLoaded then sound.Loaded:Wait() end
SongChange:FireAllClients(v)
sound:Play()
sound.Ended:Wait()
table.remove(soundtable,i)
print("Song finished, swapping to next")
end
end
while #songrequesttable >= 1 do
for i,v in pairs(songrequesttable) do
sound.SoundId = "rbxassetid://" .. v
if not sound.IsLoaded then sound.Loaded:Wait() end
SongChange:FireAllClients(v)
sound:Play()
sound.Ended:Wait()
table.remove(songrequesttable,i)
print("Song finished, swapping to next")
end
end
ReplicatedStorage.SongRequest.OnServerEvent:Connect(function(id)
--add a prompt to make them buy a dev product--
table.insert(songrequesttable,#songrequesttable + 1,id)
print("test")
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.