Skip to content

Commit

Permalink
Sound defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
hoontee committed Oct 1, 2023
1 parent 41f86d3 commit f4248b7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Useful Modules/Sound.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ local PART_EXPIRATION_TIME = 10
-- Objects
local tempFolder = New.Instance("Folder", SoundService, `__{if RunService:IsServer() then "Server" else "Client"}_Temp`)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Module Variables
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Sound.Defaults = {} :: {[string]: any}

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Module Functions
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Expand All @@ -40,6 +46,9 @@ local tempFolder = New.Instance("Folder", SoundService, `__{if RunService:IsServ
--- @return Sound -- The cloned Sound.
function Sound:Play2D(source: Sound, newProperties: {[string]: any}?): Sound
local newSound = source:Clone()
for property, value in Sound.Defaults do
(newSound :: any)[property] = value
end
if newProperties then
for property, value in newProperties do
(newSound :: any)[property] = value
Expand All @@ -58,6 +67,9 @@ end
--- @return Sound -- The cloned Sound.
function Sound:PlayIn(source: Sound, parent: BasePart, newProperties: {[string]: any}?): Sound
local newSound = source:Clone()
for property, value in Sound.Defaults do
(newSound :: any)[property] = value
end
if newProperties then
for property, value in newProperties do
(newSound :: any)[property] = value
Expand Down

0 comments on commit f4248b7

Please sign in to comment.