Skip to main content

RideMovementSoundPlugin

Plays a sound for when the ride is moving.

This is used to add sounds such as "air wooshing" and other sounds that change when a coaster train is moving.

Setup

AnimationModel's model must have a Folder named MovementSounds. This folder holds ObjectValues that point to Sounds or Sound emitter instances.

See Sound Docs for a list of properties to use in soundProperties.

Config Example

{
	soundProperties = {
		-- overwrite properties of Sound
		SoundId = "rbxassetid://0000",
	},

	folderName = "MovementSounds",

	useConstantSpeed = false,
	maxSpeed = 100.0,
	minSpeed = 0.0,

	maxVolume = 1.0,
	minVolume = 0.0,

	volumeEasingStyle = Enum.EasingStyle.Linear,
	volumeEasingDirection = Enum.EasingDirection.In,

	maxPitch = 1.0,
	minPitch = 0.5,

	pitchEasingStyle = Enum.EasingStyle.Sine,
	pitchEasingDirection = Enum.EasingDirection.In,

	fadeInTime = 1.0,
	fadeInStyle = Enum.EasingStyle.Linear,
	fadeInDirection = Enum.EasingDirection.In,

	fadeOutTime = 1.0,
	fadeOutStyle = Enum.EasingStyle.Linear,
	fadeOutDirection = Enum.EasingDirection.Out,
}

Types

PluginSettings

interface PluginSettings {
soundProperties{[string]any}--

Properties for Sound. This is also where you set the SoundId

folderNamestring--

The name of the child of the AnimationModel which this plugin will look for the sounds.

maxVolumenumber
minVolumenumber
volumeEasingStyleEnum.EasingStyle
volumeEasingDirectionEnum.EasingDirection
maxPitchnumber
minPitchnumber
pitchEasingStyleEnum.EasingStyle
pitchEasingDirectionEnum.EasingDirection
fadeInTimenumber?--

length of time sound "fades-in" when enters the section (startTrigger is fired)

fadeInStyle:Enum.EasingStyle?
fadeInDirection:Enum.EasingDirection?
fadeOutTimenumber?--

length of time sound "fades-out" when leaves the section (endTrigger is fired)

fadeOutStyle:Enum.EasingStyle?
fadeOutDirection:Enum.EasingDirection?
}

Functions

new

Constructor
RideMovementSoundPlugin.new(
animPlayerModelAnimationPlayer,
pluginSettingsPluginSettings
) → RideMovementSoundPlugin

Default constructor

setPluginSettings

RideMovementSoundPlugin:setPluginSettings(pluginSettingsPluginSettings) → ()

Bulk sets the plugin settings

setSoundProperties

RideMovementSoundPlugin:setSoundProperties(soundProperties{[string]any}) → ()

Sets the current properties of the Sounds handled by this plugin

isEnabled

RideMovementSoundPlugin:isEnabled() → ()

Returns true if this plugin is currently enabled

setIsEnabled

RideMovementSoundPlugin:setIsEnabled(valueboolean) → ()

Sets whether the plugin is enabled or disabled. While disabled, the movement sound will not play.

isActive

RideMovementSoundPlugin:isActive() → ()

Returns true if this plugin is currently enabled

setIsActive

RideMovementSoundPlugin:setIsActive(valueboolean) → ()

Sets whether the plugin is enabled or disabled. While disabled, the movement sound will not play.

getCurrentEasingAlpha

RideMovementSoundPlugin:getCurrentEasingAlpha() → number

Gets the current easing alpha of the AnimationPlayer

getCurrentSpeedAlpha

RideMovementSoundPlugin:getCurrentSpeedAlpha() → number

Returns the alpha from current speed

update

RideMovementSoundPlugin:update() → ()

Updates this plugin

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Default constructor",
            "params": [
                {
                    "name": "animPlayer",
                    "desc": "",
                    "lua_type": "ModelAnimationPlayer"
                },
                {
                    "name": "pluginSettings",
                    "desc": "",
                    "lua_type": "PluginSettings"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RideMovementSoundPlugin"
                }
            ],
            "function_type": "static",
            "tags": [
                "Constructor"
            ],
            "source": {
                "line": 119,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "setPluginSettings",
            "desc": "Bulk sets the plugin settings",
            "params": [
                {
                    "name": "pluginSettings",
                    "desc": "",
                    "lua_type": "PluginSettings"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 175,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "_setupConnections",
            "desc": "",
            "params": [],
            "returns": [],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 204,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "_updateModel",
            "desc": "",
            "params": [],
            "returns": [],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 228,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "_updateSoundsPlaying",
            "desc": "",
            "params": [],
            "returns": [],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 281,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "_setSoundProperties",
            "desc": "",
            "params": [],
            "returns": [],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 295,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "setSoundProperties",
            "desc": "Sets the current properties of the Sounds handled by this plugin",
            "params": [
                {
                    "name": "soundProperties",
                    "desc": "",
                    "lua_type": "{[string]: any}"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 305,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "_updateEnabled",
            "desc": "Updates whether sounds are playing or stopped",
            "params": [],
            "returns": [],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 313,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "isEnabled",
            "desc": "Returns true if this plugin is currently enabled",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 325,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "setIsEnabled",
            "desc": "Sets whether the plugin is enabled or disabled.\nWhile disabled, the movement sound will not play.",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 332,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "isActive",
            "desc": "Returns true if this plugin is currently enabled",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 343,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "setIsActive",
            "desc": "Sets whether the plugin is enabled or disabled.\nWhile disabled, the movement sound will not play.",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 350,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "getCurrentEasingAlpha",
            "desc": "Gets the current easing alpha of the AnimationPlayer",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 361,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "getCurrentSpeedAlpha",
            "desc": "Returns the alpha from current speed",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 381,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        },
        {
            "name": "update",
            "desc": "Updates this plugin",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 402,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "PluginSettings",
            "desc": "",
            "fields": [
                {
                    "name": "soundProperties",
                    "lua_type": "{[string]: any}",
                    "desc": "Properties for Sound. This is also where you set the SoundId"
                },
                {
                    "name": "folderName",
                    "lua_type": "string",
                    "desc": "The name of the child of the AnimationModel which this plugin will look for the sounds."
                },
                {
                    "name": "maxVolume",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "minVolume",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "volumeEasingStyle",
                    "lua_type": "Enum.EasingStyle",
                    "desc": ""
                },
                {
                    "name": "volumeEasingDirection",
                    "lua_type": "Enum.EasingDirection",
                    "desc": ""
                },
                {
                    "name": "maxPitch",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "minPitch",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "pitchEasingStyle",
                    "lua_type": "Enum.EasingStyle",
                    "desc": ""
                },
                {
                    "name": "pitchEasingDirection",
                    "lua_type": "Enum.EasingDirection",
                    "desc": ""
                },
                {
                    "name": "fadeInTime",
                    "lua_type": "number?",
                    "desc": "length of time sound \"fades-in\" when enters the section (startTrigger is fired)"
                },
                {
                    "name": "fadeInStyle:",
                    "lua_type": "Enum.EasingStyle?",
                    "desc": ""
                },
                {
                    "name": "fadeInDirection:",
                    "lua_type": "Enum.EasingDirection?",
                    "desc": ""
                },
                {
                    "name": "fadeOutTime",
                    "lua_type": "number?",
                    "desc": "length of time sound \"fades-out\" when leaves the section (endTrigger is fired)"
                },
                {
                    "name": "fadeOutStyle:",
                    "lua_type": "Enum.EasingStyle?",
                    "desc": ""
                },
                {
                    "name": "fadeOutDirection:",
                    "lua_type": "Enum.EasingDirection?",
                    "desc": ""
                }
            ],
            "source": {
                "line": 85,
                "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
            }
        }
    ],
    "name": "RideMovementSoundPlugin",
    "desc": "Plays a sound for when the ride is moving.\n\nThis is used to add sounds such as \"air wooshing\" and other sounds that change when a coaster train is moving.\n\n#### Setup\n\nAnimationModel's `model` must have a `Folder` named `MovementSounds`. This folder holds ObjectValues that point to Sounds\nor Sound emitter instances.\n\nSee [Sound Docs](https://create.roblox.com/docs/reference/engine/classes/Sound) for a list of properties to use in `soundProperties`.\n\n#### Config Example\n\n```lua\n{\n\tsoundProperties = {\n\t\t-- overwrite properties of Sound\n\t\tSoundId = \"rbxassetid://0000\",\n\t},\n\n\tfolderName = \"MovementSounds\",\n\n\tuseConstantSpeed = false,\n\tmaxSpeed = 100.0,\n\tminSpeed = 0.0,\n\n\tmaxVolume = 1.0,\n\tminVolume = 0.0,\n\n\tvolumeEasingStyle = Enum.EasingStyle.Linear,\n\tvolumeEasingDirection = Enum.EasingDirection.In,\n\n\tmaxPitch = 1.0,\n\tminPitch = 0.5,\n\n\tpitchEasingStyle = Enum.EasingStyle.Sine,\n\tpitchEasingDirection = Enum.EasingDirection.In,\n\n\tfadeInTime = 1.0,\n\tfadeInStyle = Enum.EasingStyle.Linear,\n\tfadeInDirection = Enum.EasingDirection.In,\n\n\tfadeOutTime = 1.0,\n\tfadeOutStyle = Enum.EasingStyle.Linear,\n\tfadeOutDirection = Enum.EasingDirection.Out,\n}\n```",
    "source": {
        "line": 62,
        "path": "src/shared/plugins/rideMovementSound/RideMovementSoundPlugin.lua"
    }
}