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

How to make this place a random sound?

Asked by 10 years ago

It's part of a script that is in a sound glitch fix script. I wanting to know if I could use the mathrandom function to play a different song. And the random sound would allow for the same sound to play twice before switching to the other. There is only two sounds as well.

local sJumping = newSound("http://www.roblox.com/asset/?ID=155499501")

2 answers

Log in to vote
0
Answered by 10 years ago

well i can see that newsound(id) is a function from a separate script.

however, what I would so on the other hand would be to create a table of IDs, then set up a loop to play them in sequence.

asset = "http://www.roblox.com/asset/?ID="
IDs = {155499501,1337,1234567890} -- add more sounds here, separate by a coma.
counter = 1
local sound = Instance.new("Sound",workspace) 

while true do wait()
sound.SoundId = asset..""..IDs[counter]
sound:play()
if counter < #IDs then
counter = counter + 1
else
counter = 1
end
end

This essentially cycles through a tab, or playlist, of songs.

Ad
Log in to vote
0
Answered by 10 years ago

That answer can't help me. Sorry.

Answer this question