The current identity (5) cannot PlaySound (lacking permission 5)

I’m making a plugin, and I am playing a sound in the Plugin using plugin:PlaySound(instance), but it keeps returning this error:
“The current identity (5) cannot PlaySound (lacking permission 5)”

(section of code:)

local sound = PluginSettings.Sound   -- (the sound does exist, that is not the error)

if isPlaying == false then
    isPlaying = true

	plugin:PlaySound(sound)
end

Does anyone know the issue?
Thanks,
RGF

try wrapping this into a pcall.

I wrapped it into a pcall and it just returned the same error.

local sc, er = pcall(function()
      local sound = PluginSettings.Sound  
      
      if isPlaying == false then
          isPlaying = true
      
      	plugin:PlaySound(sound)
      end
end)

if not sc then
    warn(er)
end

Output: “The current identity (5) cannot PlaySound (lacking permission 5)”

Wrong category, try changing it to Scripting Support

Try soundservice:PlayLocalSound with the sound’s ID instead?

Whoops, thought I selected scripting support!
Thanks for notifying me

You should be using SoundService:PlayLocalSound instead, it takes the sound instance you wish to play as an argument.

The PlaySound function you were trying to use is RobloxScriptSecurity and likely only for use in the toolbox.

You cant access “PlaySound” from normal scripts. Try using “PlayLocalSound()” instead (:slight_smile:
image