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

How do I make these sounds random?

Okay so I have a intro for my game, and I want it to play one song randomly picked out of say 3

and I need help.

The first script is like this

game.Workspace.introsound.Sound:Play()

any helpers?

2 answers

soundList = {
game.Workspace.IntroSound1,
game.Workspace.IntroSound2,
game.Workspace.IntroSound3
}

game.Players.PlayerAdded:connect(function(plr)
	soundList[ math.random(1,#soundList) ]:Play()
end)

Try this.

for i = 1,3 do
	
	if i == 1 then
		game.Workspace.introsound.Sound:Play()

if i ==2 then
	game.Workspace.introsound2.Sound:Play()
	
	if i ==3 then
		game.Workspace.introsound3.Sound:Play()

	end
end
	end
end

1 comment

0

Seriously, the script indexing is horrible, and this will play all three, not one.

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