Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Some people are saying the songs are overlapping?

Me and most people don't have this problem but some people are complaining that the songs in my game are overlapping. The song is found in StarterPlayerScripts to avoid resetting the music. I removed pcall in my studio to see any difference but heres the script from when people were complaining.

Heres the local script:

-- Scripted by ThePhantomDeveloper
local sounds = script.Parent
local allSounds = sounds:GetChildren()

pcall(function()
	for _, sound in pairs(allSounds) do
		game.ContentProvider:Preload(sound.SoundId)
	end
end)
while true do
	for _, sound in pairs(allSounds) do
		sound:Play()
		wait(sound.TimeLength)
	end
end

3 comments

0

also I checked if sounds is a sound or not.

0

Couldn't you use a Local Script?

0

This is a local script

2 answers

Roblox has a nice sound property called Playing, which is a boolean.

Using an if statement and a function, you could check for other sounds playing currently.

Updated version but I don't know if theres a difference:

-- Scripted by ThePhantomDeveloper
local sounds = script.Parent
local allSounds = sounds:GetChildren()

for _, sound in pairs(allSounds) do
	if sound:IsA('Sound') then
		game.ContentProvider:Preload(sound.SoundId)
	end
end

while true do
	for _, sound in pairs(allSounds) do
		sound:Play()
		wait(sound.TimeLength)
	end
end

1 comment

1

You could just edit your own question

This discussion is preserved as it was. New answers, comments, and votes are closed.