Sound of Mods

Like for adding textures and blocks, we will use the Exdilin API and will start by choosing a name.

There are two kinds of sounds: music and SFX.

Music

It is really simple, first choose a name, we'll choose never_gonna_give_you_up and our file will be named trolo.ogg.

The music or SFX file must always be an OGG file. If you have the sound in an other format (like MP3) you can use an online converter.

First here is the init function, in which we will use the exdilin.load_audio function:

function init()
    -- the rest of your function
    exdilin.load_audio("Music/never_gonna_give_you_up", "trolo.ogg")
end

And then the preinit function, which is exactly like for textures except we just replace "texture" by "music":

function preinit()
    -- whatever you had before
    exdilin.music_item("never_gonna_give_you_up").register()
end

And voilà! You just added music, A-mA-zInG !

SFX

Once you learnt how to do music, doing SFX is literally just as simple, you just have to replace music_item by sfx_item in preinit and Music by SFX in init :

function init()
    -- the rest of your function
    exdilin.load_audio("SFX/roblox_ouch", "ouch.ogg")
end

function preinit()
    -- whatever you had before
    exdilin.sfx_item("roblox_ouch").register()
end

Really, nothing extraordinary here, you just harnessed the power of music and SFX !

Last updated