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

help me make a door sound to play a open sound then closed?

how wold i make a script to play 1 sound then another in order and not at random.

script.Parent.ClickDetector.MouseClick:connect(function()
script.Parent.Sound1:Play()
end)

1 answer

✓ Accepted answer
local sounds = {10198, 292830, 201939, 013902}
-- Your Id's
local order = 0
local max_sounds = #sounds
local sound = script:WaitForChild("Sound")

script.Parent.MouseButton1Click:connect(function()
    order = order + 1 <= max_sounds and order + 1 or 1
	--[[
		if the next sound is less than or equal to the max number
		of sounds in the table then move on to the next one, if it's not, restart. 
	--]]
	local sound_id = 'rbxassetid://'..sounds[order]
	sound.SoundId = sound_id
    sound:Play()
	print(order)
end)

--[[
	ScreenGui
		TextButton
			LocalScript
				Sound
--]]

1 comment

0

this inst working.

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