Conversions
Converts between Sounds and SoundDefinitions. These do not need the schema, so they work before startup.
Neither function throws on bad input: it warns and returns a blank definition or a silent blank Sound named
VluxySF_Blank_Sound instead.
Functions
ToDefinition
Conversions.ToDefinition(sound: Sound--
The Sound to convert. Anything that is not a Sound warns and gives a blank definition.
) → SoundDefinition--
The definition.
Turns a Sound and its SoundEffect children into a SoundDefinition. Only properties that differ from the
defaults are kept, plus the name. Playback state (Playing, TimePosition) is never kept.
local definition = VluxySF.Conversions.ToDefinition(workspace.MySound)
print(definition.Properties.Volume)
FromDefinition
Conversions.FromDefinition(definition: SoundDefinition--
The definition to build. Anything without a Properties table warns and
) → Sound--
The new Sound.
Builds a new, unparented Sound from a SoundDefinition. Effects are parented under their class names. Each
effect carries its class name as Name. With no effects, pass an empty Effects table and an EffectsCount of 0.
local sound = VluxySF.Conversions.FromDefinition({
Properties = {
Name = "MySound",
SoundId = "rbxassetid://123456789",
Volume = 0.5,
},
Effects = {
EchoSoundEffect = { Name = "EchoSoundEffect", Delay = 0.5 },
},
EffectsCount = 1,
})
sound.Parent = workspace
sound:Play()
gives a blank Sound.