lol.-. but i cannot find a feature to do so, only what i can do is ‘:Play()’ it, but it does not work when you are not in the testing play session, basic logic i guess.
this is my plugin script(ripped from Roblox`s studio guide with a little changes):
local CHS=game:GetService'ChangeHistoryService'
--local Selection=game:GetService'Selection'
-- Create a new toolbar section with a name
local toolbar=plugin:CreateToolbar'HEnTYH`s Workflow'
-- Add a toolbar button in following order: 1:Name 2:Description 3:Image
local btn=toolbar:CreateButton('Create the sound','Creates a sound','rbxassetid://0')
-- Make button clickable even if 3D viewport is hidden
btn.ClickableWhenViewportHidden=true
local function on()
local parent=game:GetService'ServerScriptService'
--[[local selectedObjects=Selection:Get()
if #selectedObjects>0 then
parent=selectedObjects[1]
end]]
local s=Instance.new'Sound'
s.SoundId='rbxassetid://9245470035'
s.Name='Music'
s.Volume=1
s.Parent=game.SoundService
s:Play()
CHS:SetWaypoint'Playing sound'
end
on()
maybe also make it really local? seems like it makes a sound on the server idk, or remove the sound when i leave… i just started with it guys
To play sounds to the Player through a plugin, you need to do the following:
You need to Parent the Sound to the DockWidgetPluginGui you made (Below is what I mean by DockWidgetPluginGui, you may have it named different)
local DockWidgetPluginGui = plugin:CreateDockWidgetPluginGui("WidgetName", widgetInfo)
Then you can just :Play() the sound as normal in the script and it’ll be heard.
Example:
-- Create new 'DockWidgetPluginGuiInfo' object
local widgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float, -- Widget will be initialized in floating panel
true, -- Widget will be initially enabled
false, -- Don't override the previous enabled state
200, -- Default width of the floating window
300, -- Default height of the floating window
150, -- Minimum width of the floating window (optional)
150 -- Minimum height of the floating window (optional)
)
-- Create new widget GUI
local testWidget = plugin:CreateDockWidgetPluginGui("TestWidget", widgetInfo)
-- Creating sound
local Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://12345"
Sound.Parent = testWidget -- making sure to parent it to the DockWidgetPluginGui
-- Wait 1 second
task.wait(1)
-- Play the sound
Sound:Play()