[EDIT] i figured out myself why this wasn't working, instead of setting an id of sound to "536642316" i had to change it to "rbxassetid://536642316" (feelin very dumb right now)

So i Scripted This Module: (Parent is ServerScriptService)

local CustomFunction = {}


CustomFunction.CreateSound = function(ID, Pitch, Distance, Looped, Parent, SoundName, Volume, PlayDelay)
	
	local Sound = Instance.new("Sound", Parent)
	Sound.Looped = Looped
	Sound.MaxDistance = Distance
	Sound.Name = SoundName
	Sound.Parent = Parent
	Sound.PlaybackSpeed = Pitch
	Sound.SoundId = ID
	Sound.Volume = Volume
	
	wait(PlayDelay)
	Sound:Play()
	game:GetService("Debris"):AddItem(Sound, Sound.TimeLength + PlayDelay + 1)
	
end


return CustomFunction

My Script: (Not a LocalScript)

local Module = require(game:GetService("ServerScriptService"):WaitForChild("CreationModule"))

CreationModule.CreateSound(536642316, math.random(95/100,120/100), 100, false, Character.Head, "Swing", 0.5, 0.2)

forget about the properties, the script should work but it throws a error:
"Failed to load sound 536642316: Unable to download sound data"
why "unable to download sound data"?
what can i do to fix this?

4 comments

0

Likely a problem with copyright or something.

0

@incapaz if the ID is copyrighted it plays calming music. Either you inserted the ID incorrectly or the ID doesn't exist.

0

I've had a similar problem as well, if I try to play a song by with a script that changes the SoundId and then does sound:Play(), I get the same error.