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

How do I choose a sounds SoundID in a script?

Its a very simple script yet im stumped. Seems like selecting an asset id is different than I thought. I've looked in the API reference to only find things about "assetId". Could I have some help? Thank you :)

local thunderplay = script:WaitForChild("ThunderPlay")

while true do
	
	local pickrandomsound = math.random(1,8)
	local waitfornextdeploy = math.random(10,30)
	
	print(pickrandomsound.. ", was chosen. Waiting: ".. waitfornextdeploy)
	
	if pickrandomsound == 1 then
		script.ThunderPlay.SoundId = 3955551592
		wait(2)
		script.ThunderPlay:Play()
	end
	
	if pickrandomsound == 2 then
		script.ThunderPlay.SoundId = 3955552029
		wait(2)
		script.ThunderPlay:Play()
	end
		
	if pickrandomsound == 3 then
		script.ThunderPlay.SoundId = 3955552642
		wait(2)
		script.ThunderPlay:Play()
	end
			
	if pickrandomsound == 4 then
		script.ThunderPlay.SoundId = 3955553210
		wait(2)
		script.ThunderPlay:Play()
	end
	
	if pickrandomsound == 5 then
		script.ThunderPlay.SoundId = 3955553719
		wait(2)
		script.ThunderPlay:Play()
	end
	
	if pickrandomsound == 6 then
		script.ThunderPlay.SoundId = 3955554293
		wait(2)
		script.ThunderPlay:Play()
	end
		
	if pickrandomsound == 7 then
		script.ThunderPlay.SoundId = 3955555207
		wait(2)
		script.ThunderPlay:Play()
	end
			
	if pickrandomsound == 8 then
		script.ThunderPlay.SoundId = 3955559554
		wait(2)
		script.ThunderPlay:Play()
	end
	
	wait(waitfornextdeploy)
	
end

1 answer

✓ Accepted answer

Hello, you are trying to play audio with just id. Solution would be to put "rbxassetid://" in front of the id, example:

Sound.SoundId ="rbxassetid://".."yourid"

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