Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I play a sound through a script?

Asked by 3 years ago

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

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

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.

0
Ah, thank you AHeldalil 1 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

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();
Log in to vote
0
Answered by 3 years ago

Use the function

:Play()

on the sound object. For example:

workspace.Sound:Play()

Answer this question