Script not working as it is supposed to

Hey hi out there this sound script isn’t working as it is supposed to as it is supposed to play the sound the moment u join the game but instead it’s giving this error

HERE IS THE SCRIPT

local Sound = game.Workspace.Sound 
local ContentProvider = game:GetService("ContentProvider") 

ContentProvider:PreloadAsync(279206904) 

Sound:Play()

This error is occurring because PreloadAsync accepts an Array of Instances to be loaded not a asset ID.

Instead of inserting a asset ID, provide your Sound object inside of an Array, like so:


ContentProvider:PreloadAsync({Sound})

PreloadAsync looks through each of the objects inside of the Array you pass it, and loads anything that can be loaded inside of those objects.

You have to pass Sound objects, instead of just AssetIds, due to this update made a while back:

so well how do i fix that? Can u help i am learning to script

I would recommend just doing

local Sound = game.Workspace.Sound 
Sound.SoundId = 279206904

Sound:Play()

Also you loaded the sound and did nothing with it

Just edited the post with a bit more of a explanation!

man it dosent work this is the new error

13:25:44.456 - Failed to load sound 279206904: Unable to download sound data

There can be multiple reasons for this error, but usually this is because your sound doesn’t exist.

But the problem is syntax. You need to write “rbxassetid://” and end it with your id for sound.

Try

Sound.SoundId = "rbxassetid://279206904"

instead.

2 Likes