Music Player not working

Still same thing adhihdiadha er man this is kinda sad

How are you testing it?
Do you have short sounds and wait them out?

I think I know why. Its probably has to do with the RunService I have on it.

image
This helps the bar at the bottom of the screen to be in sync with the time

Hm I don’t see anything that might be affecting it.

Again, how do you test it? Do you have short sounds and wait them out?

Yea short sounds and wait them out

I would print before and after every checkpoint so you can isolate your issue

example
print("Starting")
do something
print("Starting for loop")
for i,v in pairs(something) do
	print("Iterating through one thing")
end
print("Ended for loop")

It seems to break due to the MarketPlaceService:GetProductInfo(id)
You could try making a table which stores the product info for all the IDs before playing.

Also the reused sound check kind of broke it.

When testing without the MarketPlaceService:GetProductInfo(id)` line it work’s like a charm.

local MarketPlaceService = game:GetService("MarketplaceService")
local currentSound = game.ReplicatedStorage:FindFirstChild("CurrentMusic")

local songs = script:GetChildren()
local TVs = game.Workspace.TVScreens:GetChildren()

local SongInfo = {}
local RandomSongs = {}

function RandomizeTable(tbl)
	local returntbl={}
	returntbl = tbl
	local j, temp
	for i = #returntbl, 1, -1 do
		j = math.random(i)
		temp = returntbl[i]
		returntbl[i] = returntbl[j]
		returntbl[j] = temp
	end
	return returntbl
end

RandomSongs = songs
RandomSongs = RandomizeTable(RandomSongs)

for i, model in pairs(script:GetChildren()) do
	local NewsongInfo = MarketPlaceService:GetProductInfo(model.Value)
	warn(NewsongInfo)
	SongInfo[model.Value] = NewsongInfo
end

while true do
	for pos,song in ipairs(RandomSongs) do
		local id = song.Value
		currentSound.SoundId = "rbxassetid://" ..id
		currentSound.TimePosition = 0
		
		currentSound.Loaded:Wait()
		print("Loaded")
		currentSound:Play()
		print("Playing")
		repeat wait() until not currentSound.Playing
		currentSound:Stop()
		currentSound.TimePosition = 0
	end
end

This is a new script I made.
If you use it then let me know if it works.

It doesn’t have the screen stuff in it though. You can put a function or something in the for loop to do that.