← MPP-Mainstore › Scripts MPP - Sound States On Grab Download the documentation (.md)

Version 1.1.2 · updated September 24, 2026

MPP - Sound States On Grab Script V1.1.2 - Documentation

Gives a prop three sound states: a base sound while nobody holds it (a hum, an ambience, a music pad), a held sound while a visitor carries it, and a release sound when they let it go, played once or looped until the base sound comes back. The sounds play from the object itself, so they follow it around the scene.

This script is standalone - it does not require any other MPP script to function.

New in V1.1.2: a quick release, grab and release no longer cuts the release sound short nor starts the base sound twice; a volume of 0 really plays no sound; warnings in the script console for a missing audio component, a wrong component name, an object that cannot be grabbed or a release loop too short to be heard; a Debug Logging switch that writes every sound start. Settings grouped by category in the Build panel. Your settings are kept when you update: see "Updating from v1.1".


Quick Start

  1. After purchase, the script is in your Inventory in Build mode. Add it to a prop your visitors can pick up: a lantern, a music box, a toy.
  2. Make sure the object is a physics object (a RigidBody) that can be grabbed, and add an Audio component to it so the sounds follow the object.
  3. Assign your sounds from your inventory: Base/Sound (usually a loop), Held/Sound (usually a loop), Release/Sound (usually a one-shot).
  4. Build and visit. The base sound plays; pick the object up: the held sound takes over; let it go: the release sound plays, then the base sound comes back.

That is all most props need. The rest of this guide details every option.


How It Works

MomentWhat plays
Scene startBase/Sound, if assigned (looped by default)
GrabThe base and release sounds stop, Held/Sound starts
ReleaseThe held sound stops, Release/Sound plays (once, or looped)
After the releaseWith Release/Resume Base After Release On, the base sound comes back after Release/Base Resume Delay Seconds; a looping release sound stops at that moment, a one-shot one is left to finish

Each sound has its own Volume (0 to 200 percent, 100 = the sound as recorded, 0 = no sound at all) and its own Looping switch. In the Build panel the settings are grouped by category: Audio/, Base/, Held/, Release/ and Debug/.


Audio Component

The sounds are played on the object's Audio component, so they move with the object when it is carried.


Base Sound


Held Sound


Release Sound

A fast release, grab and release keeps the full delay from the last release: the release sound plays its full time and the base sound starts once.


Volume

The three Volume settings go from 0 to 200 percent and are converted to decibels: 100 = the sound as recorded, 50 = about -6 dB (half the amplitude), 200 = about +6 dB (twice the amplitude). 0 = the sound is not played at all; the other two sounds behave as usual, and a muted release sound keeps its delay before the base sound comes back.


Editor Properties Reference (13 total)

Audio

PropertyTypeDefaultDescription
Audio/Audio Component Namestring(empty)Audio component to play from; empty or not found = the first one

Base

PropertyTypeDefaultDescription
Base/SoundSoundResource(none)Sound while the object is not held
Base/Volumenumber, 0-200100Loudness in percent; 0 = no sound
Base/LoopingboolOnLoop until the next grab; Off = once

Held

PropertyTypeDefaultDescription
Held/SoundSoundResource(none)Sound while the object is held
Held/Volumenumber, 0-200100Loudness in percent; 0 = no sound
Held/LoopingboolOnLoop while held; Off = once per grab

Release

PropertyTypeDefaultDescription
Release/SoundSoundResource(none)Sound played at the release
Release/Volumenumber, 0-200100Loudness in percent; 0 = no sound
Release/LoopingboolOffLoop until the next grab or the base resume; Off = once
Release/Resume Base After ReleaseboolOnThe base sound comes back after each release
Release/Base Resume Delay Secondsnumber, 0-50.1Delay before the base sound comes back

Debug

PropertyTypeDefaultDescription
Debug/Debug LoggingboolOffWrites the chosen Audio component and each sound start (base, held, release) to the script console

Version Notes

VersionWhat changed
v1.0First release: base, held and release sounds, volumes in percent, Audio component or fixed position
v1.1Release sound loop or one-shot, base resume with delay. Sold until V1.1.2
V1.1.1Quick release / grab / release fixed (full delay, base started once), Volume 0 = no sound, warnings for a wrong setup, Debug Logging, settings grouped by category
V1.1.2 (this version)Version number only

Updating from v1.1

v1.1V1.1.2
Audio Component NameAudio/Audio Component Name
Base (Idle) Sound, Base Volume (%), Base LoopingBase/Sound, Volume, Looping
Held Sound, Held Volume (%), Held LoopingHeld/Sound, Volume, Looping
Release Sound, Release Volume (%), Release LoopingRelease/Sound, Volume, Looping
Resume Base After Release, Base Resume Delay (sec)Release/Resume Base After Release, Base Resume Delay Seconds
Debug LogDebug/Debug Logging

Recipes

A - Lantern. Base: a soft hum loop at 60. Held: a short click, Looping Off. Release: an air whoosh, Looping Off, 90. Resume On, delay 0.15.

B - Music box. Base: a music loop at 50. Held: the same music at 100, Looping On. Release: nothing. Resume On, delay 0: the music simply gets louder while held.

C - Magic orb. Base: nothing. Held: an energy loop. Release: a long reverb tail, Looping On. Resume Off: the tail loops until the next grab.

D - One sound only. Only Held/Sound set: silence, then a sound while the object is carried.


Troubleshooting

SymptomCheck
No sound on grab or releaseThe object needs a RigidBody that can be grabbed: "No RigidBodyComponent found" or "This object cannot be grabbed at scene start" in the script console. Check that a sound is assigned and its volume is above 0
The sound stays where the object wasNo Audio component on the object ("No AudioComponent found..." at start): add one. Or Audio Component Name is wrong ("not found on this object: using its first AudioComponent")
The release loop is cut almost at onceRelease/Base Resume Delay Seconds is the length of the loop when Resume Base After Release is On: raise it (a warning says so at start), or turn Resume Off
The base sound and the release sound overlapSet Base Resume Delay Seconds to the length of the release sound
The base sound never comes backRelease/Resume Base After Release Off, or Base/Looping Off with a short sound
Too loud or too quietAdjust the Volume of that sound (percent); 0 = muted
I want to know what the script doesTurn Debug/Debug Logging On: the script console shows the Audio component chosen and every sound start

Limits


ItemWhat it adds
Light Drain And Restore ScriptA light that dims and a rainbow on the same prop while it is held. Store: https://www.sansar.com/store/listings/95238b17-f553-4656-88b6-6bf10e4070b9/light-drain-and-restore-script
Gravity Drift On Grab ScriptThe prop floats up like a balloon once released. Store: https://www.sansar.com/store/listings/d74417ad-2b75-41b2-9bd7-7a96cf12eef9/gravity-drift-on-grab-script

MPP - My Pretty Pixels. Sound States On Grab Script V1.1.2 (script MPP - Sound States On Grab). Store: https://www.sansar.com/store/listings/3495dbd5-f76f-452a-a43a-2445d5304815/sound-states-on-grab-script

↑