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

Making a music script use a table???

local Sound = script.Sound
local ContendProvider = game:GetService("ContentProvider")

local MaxSound = 2

local CurrSound = 0

local Music = {
	551334045,
	1524396093,
	627848963,
	
}




while true do
	if CurrSound <= MaxSound then
		Sound.SoundId = "rbxassetid://"..Music[CurrSound]
		CurrSound = CurrSound + 1
		Sound:Play()
		Sound.Ended:Wait()
	else
		CurrSound = 0
	end
end

i tried making this music script and im new to tables can someone explain to me what i did wrong

Output error / Players.ExternalSight.PlayerGui.MusicScript:20: attempt to concatenate string with nil  

1 answer

✓ Accepted answer

Ah. CurSound has to be greater than 0. You're trying to get the 0th string in the table.

1 comment

1

Ah my bad i tought tables started at 0 instead of 1

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