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:
To enhance asset type safety, ContentProvider:PreloadAsync function now works with instance list. It will gather asset ids from instances and their children recursively.
An example : ContentProvider:PreloadAsync({ game.Workspace.Model1, game.Workspace.Part1})
If you pass in id strings (the old way), those ids will be assumed as images, other types will failed to request. This will cause some error messages printed out. Edit: Sorry for the trouble I caused today. I’ve turned this off. Now you …
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
Carnasuss
(Carnasuss)
August 25, 2020, 8:07am
#7
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