学ぶ
エンジンクラス
SoundService
作成できません
サービス

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。


コードサンプル
ダイナミックリバーブシステム
local Players = game:GetService("Players")
local CollectionService = game:GetService("CollectionService")
local SoundService = game:GetService("SoundService")
local localPlayer = Players.LocalPlayer
local reverbTags = {
["reverb_Cave"] = Enum.ReverbType.Cave,
}
-- 部品を収集し、タグによってグループ化します
local parts = {}
for reverbTag, reverbType in pairs(reverbTags) do
for _, part in pairs(CollectionService:GetTagged(reverbTag)) do
parts[part] = reverbType
end
end
-- 位置が部品の範囲内にあるかをチェックする関数
local function positionInPart(part, position)
local extents = part.Size / 2
local offset = part.CFrame:PointToObjectSpace(position)
return offset.x < extents.x and offset.y < extents.y and offset.z < extents.z
end
local reverbType = SoundService.AmbientReverb
while true do
task.wait()
if not localPlayer then
return
end
local character = localPlayer.Character
-- デフォルトはリバーブなし
local newReverbType = Enum.ReverbType.NoReverb
if character and character.PrimaryPart then
local position = character.PrimaryPart.Position
-- インデックス付きのすべての部品を通過します
for part, type in pairs(parts) do
-- キャラクターがその中にいるか確認します
if positionInPart(part, position) then
-- そうであれば、そのリバーブタイプを選択します
newReverbType = type
break
end
end
end
-- リバーブタイプが変更された場合は設定します
if newReverbType ~= reverbType then
SoundService.AmbientReverb = newReverbType
reverbType = newReverbType
end
end

APIリファレンス
プロパティ
AcousticSimulationEnabled
並列読み取り
機能: Audio
SoundService.AcousticSimulationEnabled:boolean

AmbientReverb
並列読み取り
機能: Audio
SoundService.AmbientReverb:Enum.ReverbType

CharacterSoundsUseNewApi
プラグインのセキュリティ
並列読み取り
機能: Audio
SoundService.CharacterSoundsUseNewApi:Enum.RolloutState

DefaultListenerLocation
プラグインのセキュリティ
並列読み取り
機能: Audio
SoundService.DefaultListenerLocation:Enum.ListenerLocation

DistanceFactor
並列読み取り
機能: Audio
SoundService.DistanceFactor:number

DopplerScale
並列読み取り
機能: Audio
SoundService.DopplerScale:number

ListenerCFrame
並列読み取り
機能: Audio
SoundService.ListenerCFrame:CFrame

ListenerObject
並列読み取り
機能: Audio
SoundService.ListenerObject:Instance

ListenerType
並列読み取り
機能: Audio
SoundService.ListenerType:Enum.ListenerType

RespectFilteringEnabled
並列読み取り
機能: Audio
SoundService.RespectFilteringEnabled:boolean

RolloffScale
並列読み取り
機能: Audio
SoundService.RolloffScale:number

VolumetricAudio
スクリプト作成できません
並列読み取り
機能: Audio
SoundService.VolumetricAudio:Enum.VolumetricAudio

方法
GetListener
機能: Audio
SoundService:GetListener():Tuple
戻り値

GetMixerTime
機能: Audio
SoundService:GetMixerTime():number
戻り値

OpenAttenuationCurveEditor
プラグインのセキュリティ
機能: Audio
SoundService:OpenAttenuationCurveEditor(selectedCurveObjects:Instances):()
パラメータ
selectedCurveObjects:Instances
戻り値
()

OpenDirectionalCurveEditor
プラグインのセキュリティ
機能: Audio
SoundService:OpenDirectionalCurveEditor(selectedCurveObjects:Instances):()
パラメータ
selectedCurveObjects:Instances
戻り値
()

PlayLocalSound
機能: Audio
SoundService:PlayLocalSound(sound:Instance):()
パラメータ
sound:Instance
戻り値
()

SetListener
機能: Audio
SoundService:SetListener(
listenerType:Enum.ListenerType, listener:Tuple
):()
パラメータ
listenerType:Enum.ListenerType
listener:Tuple
戻り値
()

©2026 Roblox Corporation。Roblox(ロブロックス)、RobloxロゴおよびPowering Imaginationは、米国並びにその他の国における登録商標および非登録商標です。