How To Use PlayLocalSound

local SoundService = game:GetService("SoundService")

local function playLocalSound(soundId)
	local sound = Instance.new("Sound")
	sound.SoundId = soundId
	sound:Play()
	sound.Ended:Wait()
	sound:Destroy()
end


playLocalSound(4645365277)

this is my script. i don’t know what i’m doing wrong either :pensive:

actually this script wouldnt work now that i think about it

oh wait I see change that to this: local sound = Instance.new("Sound", game.SoundService)

Alright i believe it should work now, the sound doesnt below to me but i got the error unable to load so thanks

Nevermind, every sound i put even sounds uploaded by me i get the same error

Yeah that’s an issue I don’t know how to fix.

Fixed the error but now it doesnt play anything

You just need to put a string around the numbers in the playLocalSound function & set it as an id:

playLocalSound("rbxassetid://4645365277")

Hi. What is the source of the sound? I see that you are including the asset id. What type of sound file are you using? MP3? How did you upload the sound file? Can you manually click on the sound file in Roblox Studio and play it?

Answering these questions might help you discover the problem.