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

How do I do this?

Asked by 9 years ago

What I would like to do is add my own sound function while creating the said sound.

Here is a sample of the function:

function Run()
    while wait() do
        S:Play()
        wait(math.random(0.1, 0.4))
        S:Stop()
    end
end

and here is a sample what I have so far with making the sound, don't worry about the other things like missing values:

repeat
Sounds = Sounds + 1
local S = Instance.new("Sound", game.Soundscape)
S.SoundId = "http://www.roblox.com/asset/?id=" .. bangsounds[math.random(1, #bangsounds)]
game:GetService("Debris"):AddItem(S, math.random(0,#bangsounds))
S.Looped = true
  -- The function code goes here!
until
Sounds == 4
  • I hope the code above helps with my problem.

Answer this question