Plugins can't play sounds without RunService:Run()

I was adding SFX to my VFX plugin when i noticed my sounds are not playing.
i searched and found out i have to use RunService:Run() (which starts physics simulation, runs scripts and disables undoing (ctrl + z))

it sounds stupid to me that you can’t play sounds without physics simulation & running scripts.

if security is a concern. make a PluginPermission for playing sounds.

Expected behavior

I expect plugins to be able to play sounds anywhere not just with SoundService and without the need of RunService:Run().

Also sounds under parts or attachments should work normally like they do in play-testing.
that will also allow developers to test spatial sounds by playing it from the command bar instead of going in and out of play-testing.

Hi @coroutine_yieId

I found solution and it works becasue i tested it

Here is source:

You need to parent sound into DockWidgetPluginGui

My plugin script

local Toolbar = plugin:CreateToolbar("Toolbar")

local PlayTheSound = Toolbar:CreateButton("b","Button","")

local Sound = script:FindFirstChild("Sound")

local DockWidgetGui = plugin:CreateDockWidgetPluginGui("SoundHolder",DockWidgetPluginGuiInfo.new(
	Enum.InitialDockState.Left,
	false,
	false,
	500,
	500,
	200,
	200
	)
)

Sound.Parent = DockWidgetGui
Sound:Stop()

PlayTheSound.Click:Connect(function()
	if Sound.IsPlaying then
		Sound:Stop()
	else
		Sound:Play()
	end
end)

You don’t need any permission

Note:DockWidgetGui is just for holding sounds nothing else

Just make sure dockwidgetplugininfo is not Enabled and
InitialEnabled ,InitialEnabledShouldOverrideRestore must be false or it will randomly pop up DockWidgetPluginGui when starting

Hi @xcreatee
Your solution works perfectly for gui sounds.
but is there a way to play sounds that are in a part/attachment?

Clone sound into DockWidget and then destroy it after sound is finished?

i mean they have to be in the part/attachment so that you can hear depending on the position

1 Like

Wait a sec i need to test maybe it will work

Clone part that contains sound and make parent DockWidgetGui?

Yep it works i tested it

make sure it clones into dockwidget and then after sound stop playing destroys part or Attachment that conatins sound

Sound is different based on position

If you need script i can give you

Works!! thanks so much :heart:

1 Like