26 lines
527 B
Lua
26 lines
527 B
Lua
local module = {}
|
|
|
|
function module.new(this,boombox,context)
|
|
this.sound = _G.GetInstance(_G.GetInstance(boombox,"Plank"),"Sound")
|
|
end
|
|
|
|
module.messages = {
|
|
source = function(this,speaker,context,value)
|
|
this.sound.SoundId = "rbxassetid://"..(tostring(value or "") or "")
|
|
end,
|
|
default = function(this,speaker,context,value)
|
|
if value > 0.5 then
|
|
this.sound:Play()
|
|
elseif value == 0 then
|
|
this.sound:Pause()
|
|
elseif value < -0.5 then
|
|
this.sound:Stop()
|
|
end
|
|
end,
|
|
}
|
|
|
|
module.manifest = {
|
|
"Boombox"
|
|
}
|
|
|
|
return module |