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

When I run My script the outpt says I cant load the sound what do i do ?

Asked by 3 years ago
~local SoundService = game:GetService("SoundService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GameMusic = require(ReplicatedStorage:WaitForChild("GameMusic"))

local function MusicPlay()
    for i,music in pairs(GameMusic) do

        local sound = Instance.new("Sound")
        sound.SoundId = music
        sound.Parent = SoundService:FindFirstChild("GameTrack")
        local audio = SoundService:FindFirstChild(sound)

        if not audio.IsLoaded then

            audio.Loaded:Wait()
        else

            warn("Couldnt load audio")

        end

        audio:Play()

    end



end
MusicPlay()

the output says : Failed to load sound 1500963599: Unable to download sound data

1 answer

Log in to vote
0
Answered by 3 years ago

Make sure your sound data is is associated with rbx asset ID.

All sounds MUST have 'rbxassetid://' before the actual sound ID.

For example:


local Id = "123456789" game.Workspace.Sound.SoundId = Id --This would cause an error because it isn't registered with rbxassetid:// game.Workspace.Sound.SoundId = "rbxassetid://" .. Id --Wont cause an error because is registered with rbxassetid://

Keep in mind, this is only when a script is setting the Id. In studio you can just put in the number and it will automatically register it for you. This error will also happen when a sound doesn't exist, or was moderated.

Ad

Answer this question