Why use Sound?
Sound provides audio feedback for actions and environments. SoundId identifies the audio asset; whether it plays depends on asset availability, permissions, and runtime audio settings.
Try it in Roblox Studio
In Studio, add a Sound named DoorOpen under a Part named Door and assign it an audio asset you are allowed to use. Put this Script in ServerScriptService.
Syntax
sound:Play()Examples
Sound playback
Play a configured sound without inventing an asset ID.
local door = workspace:WaitForChild("Door")
local sound = door:WaitForChild("DoorOpen")
assert(sound:IsA("Sound"))
if sound.SoundId ~= "" then
sound.Volume = 0.5
sound:Play()
end- The Sound instance and its permitted SoundId are configured in Studio.
- Volume changes its playback level; Play begins playback when the asset can be loaded.
- The nonempty check avoids calling Play for an unconfigured sound, but it cannot guarantee asset permission or successful loading.
Best practices
- Use audio assets with the correct ownership and permissions.
- Keep sound levels comfortable and test on multiple devices.
Runtime & versions
Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Luau documentation