Scripting Error: Unable to cast an array

So i’m trying the add a sound whenever the players get loaded into the game first but i’ve got this error and i dont know how to fix it. Would anybody suggest how i’d fix this error? Error:Unable to cast an array.
The error is on line 3

local sound = game.Workspace.Sound
local ContentProvider = game:GetService("ContentProvider")
ContentProvider:PreloadAsync(sound)
sound:Play()```
1 Like

PreloadAsync() requires an array of the instances to be loaded, (aka {sound}) and the callback function that runs when it’s loaded.
So taking this in account, contentprovider:PreloadAsync({sound}, function()
print(‘object was loaded’)
end)

would be the correct way to use this function

6 Likes