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

How do I choose a sounds SoundID in a script?

Asked by
proo34 41
5 years ago
Edited 5 years ago

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

Log in to vote
0
Answered by
karlo_tr10 1233 Moderation Voter
5 years ago

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"
Ad

Answer this question