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

How do I play audio in my game? [closed]

Asked by 4 years ago

I want to play audio from the ROBLOX Library in a script. How do I do that?

0
create a sound instance and set its id to your song id then click play, script the rest... but thats how you play a sound in studio greatneil80 2647 — 4y
0
so like local id = 1234 id:Play() ? soccerstardance251 29 — 4y
0
yes but you would need to do id.SoundId = "1234" greatneil80 2647 — 4y

Closed as Not Constructive by youtubemasterWOW and JesseSong

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://YOURID"
sound.Parent = workspace
sound:Play()
0
That worked, thank you! soccerstardance251 29 — 4y
0
no problem. laurenbtd5 379 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Step One: Make a folder in Workspace and name it 'Sounds'

Step Two: Insert a Sound into the Sounds Folder and name it 'Song1'. Change the SoundId in Properties to the ID you want it to be.

Step Three: Insert a Script. A good place for this would be game.ServerScriptService. In the script, type in:

local waitTime = 1 --Change this to the amount of seconds until the song starts

game.Workspace.Sounds.Song1:Play()

Hope this helps. Notify me if it doesn't work, and I'll find a new way. Upvote and mark as complete if it helps!

0
lol rip greatneil80 2647 — 4y
0
>:( JB_SuperGamer 165 — 4y