Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I play a sound through a script?

I'm not sure how to do this. I know I'm supposed to use sound:Play but I don't know how to. Help? Also, if you could explain it step by step it would be helpful.

3 answers

✓ Accepted answer

First make the sound object variable. For example:

local mySound = game.Workspace.Sound --Or other location

Then use function :Play(). Is just really easy to understand what it does:

Plays the sound.

Change your script like this:

local mySound = game.Workspace.Sound --Or other location

mySound:Play()

Now when you play the game, the song will be played.

1 comment

0

Ah, thank you

The function :Play() Is used to play sound objects, similarly :Stop() and :Pause() stop and pause it.

So to play it:

local sound = -- // wherever it may be;
sound:Play();

Or to pause it:

local sound = -- // wherever it may be;
sound:Pause();
-- // sound:Stop();

Use the function

:Play()

on the sound object. For example:

workspace.Sound:Play()

This discussion is preserved as it was. New answers, comments, and votes are closed.