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

Why does this simple code not play the song?

Asked by 9 years ago

Hey guys! I have this code for a radio. I checked all sound ID's, and tested each separately. They're correct. But with this code, the songs don't play. Why?

while wait() do
    songs = script.Parent:GetChildren()
    rando = math.random(1,#songs)
    if songs[rando].Name ~= "Script" then
        workspace["Now Playing"].Value = songs[rando].Name
        songs[rando]:Play()
    end
end
0
Give me a link the model? RM0d 305 — 9y

1 answer

Log in to vote
0
Answered by
iFlusters 355 Moderation Voter
9 years ago

You've put:

workspace["Now Playing"].Value = songs[rando].Name

You've missed out game., so it would be:

game.Workspace["Now Playing"].Value = songs[rando].Name
0
I approve ^ neoG457 315 — 9y
0
iFlusters, you are allowed to say workspace without game, so your answer is wrong. groovydino 2 — 9y
0
Both work. fahmisack123 385 — 9y
0
Sorry. iFlusters 355 — 9y
Ad

Answer this question