# Adding a Snapshot Module to grouptrack via FMOD Studio Scripting API

**URL:** <https://qa.fmod.com/t/adding-a-snapshot-module-to-grouptrack-via-fmod-studio-scripting-api/19401>\
**Category:** FMOD Studio\
**Created:** [October 14, 2022, 1:38pm UTC](https://qa.fmod.com/t/adding-a-snapshot-module-to-grouptrack-via-fmod-studio-scripting-api/19401 "2022-10-14T13:38:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![roc\_lee](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@roc\_lee](https://qa.fmod.com/u/roc_lee)\
**Post date:** [October 14, 2022, 1:38pm UTC](https://qa.fmod.com/t/adding-a-snapshot-module-to-grouptrack-via-fmod-studio-scripting-api/19401/1 "2022-10-14T13:38:44Z")

</div>

I’m getting validation errors when trying to add a snapshot module to a group track via script. Ideally would love to just have a snapshot on a hotkey to add wherever I need it instead of copy-pasting, especially since there’s 3 or 4 different ones I need to apply quickly in different situations.

It seems that the normal [Grouptrack].addSound() doesn’t work with snapshot instruments, so I’ve been trying to do something like this:

```auto
            var snptrack = newevent.addGroupTrack("Snapshot");
            var snapshotInst = studio.project.create("SnapshotModule");
            snptrack.relationships.modules.add(snapshotInst);

```

I’ve also tried doing it with `snptrack.event.timeline.relationships.modules.add()` but both don’t seem to work. The return is TRUE but the instrument is not visible and FMOD will want to validate the project, after which it removes the relationships but the Snapshot Instrument I created still exists in the abstract.

What is required to create a valid Snapshot Module? I tried giving it a length and start time as well, but that doesn’t validate the object. Or where does it want to be attached?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [October 20, 2022, 2:03am UTC](https://qa.fmod.com/t/adding-a-snapshot-module-to-grouptrack-via-fmod-studio-scripting-api/19401/2 "2022-10-20T02:03:06Z")

</div>

Hi,

You were super close! Here is one way to add a snapshot module:

```auto
var snap = studio.project.create("Snapshot");
snap.name = "MySnapshot"

var evt = studio.project.create("Event");
evt.name = "MyEvent"

var inst = studio.project.create("SnapshotModule");
inst.event = snap
inst.audioTrack = evt.masterTrack
inst.parameter = evt.timeline

```

You can substitute creating an new snapshot and event with ones already present in your project.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![roc\_lee](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@roc\_lee](https://qa.fmod.com/u/roc_lee)\
**Post date:** [October 27, 2022, 2:31am UTC](https://qa.fmod.com/t/adding-a-snapshot-module-to-grouptrack-via-fmod-studio-scripting-api/19401/3 "2022-10-27T02:31:14Z")

</div>

Thanks so much! I was able to make this with your help:  
 ![XMUbyEviDP](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/7/7380e8bcbc5c0a7cb8b844ba6cc3f973cdbf081f.gif)

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [October 27, 2022, 3:33am UTC](https://qa.fmod.com/t/adding-a-snapshot-module-to-grouptrack-via-fmod-studio-scripting-api/19401/4 "2022-10-27T03:33:59Z")

</div>

No worries!

That is an awesome tool! If you have any more scripting questions please let me know!
