forked from rojo-rbx/rojo
* Switch git submodules to Wally packages * Update build snapshot * Add wally to foreman and use latest versions * Install packages in CI runners * Fix indents * Install packages in the correct directory * Install packages in correct dir of release action too * Remove submodules from ci checkout * Remove submodules from release checkout * Update selene with latest fix * Fix whitespace Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
39 lines
878 B
Lua
39 lines
878 B
Lua
-- Sounds only play in Edit mode when parented to a plugin widget, for some reason
|
|
local plugin = plugin or script:FindFirstAncestorWhichIsA("Plugin")
|
|
local widget = nil
|
|
if plugin then
|
|
widget = plugin:CreateDockWidgetPluginGui("Rojo_soundPlayer", DockWidgetPluginGuiInfo.new(
|
|
Enum.InitialDockState.Float,
|
|
false, true,
|
|
10, 10,
|
|
10, 10
|
|
))
|
|
widget.Name = "Rojo_soundPlayer"
|
|
widget.Title = "Rojo Sound Player"
|
|
end
|
|
|
|
local SoundPlayer = {}
|
|
SoundPlayer.__index = SoundPlayer
|
|
|
|
function SoundPlayer.new(settings)
|
|
return setmetatable({
|
|
settings = settings,
|
|
}, SoundPlayer)
|
|
end
|
|
|
|
function SoundPlayer:play(soundId)
|
|
if self.settings and self.settings:get("playSounds") == false then return end
|
|
|
|
local sound = Instance.new("Sound")
|
|
sound.SoundId = soundId
|
|
sound.Parent = widget
|
|
|
|
sound.Ended:Connect(function()
|
|
sound:Destroy()
|
|
end)
|
|
|
|
sound:Play()
|
|
end
|
|
|
|
return SoundPlayer
|