Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

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

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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

Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
9 years ago
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
--]]

0
this inst working. Xandenge 0 — 9y
Ad

Answer this question