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

How do I allow the player to choose the song?

Asked by
Avoxea 48
5 years ago

Here is my script. it gives me an error message: 18:43:02.550 - Failed to load sound rbxassetid://0: Unable to download sound data (x2)

button = script.Parent.Parent.TextButton
button.MouseButton1Click:Connect(function()
    stringID = script.Parent
    game.ReplicatedStorage.newSong.Value = tonumber(stringID.Text)
    game.Workspace.Sound.SoundId = "rbxassetid://"..game.ReplicatedStorage.newSong.Value
end)

0
Are you using a string value? If not, try using one (I think it might work, but I'm going off of a limb). cmgtotalyawesome 1418 — 5y
0
No, that didn't work. It just turned it from 0 to nil Avoxea 48 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
script.Parent.Parent.TextButton.MouseButton1Click:Connect(function()
    local stringID = script.Parent.Text
    game.ReplicatedStorage.newSong.Value = tostring(tonumber(stringID))
    game.Workspace.Sound.SoundId = "rbxassetid://"..game.ReplicatedStorage.newSong.Value
    game.Workspace.Sound:Play()
end)

That should work. Make sure "newSong" is a stringValue

0
22:51:16.462 - Failed to load sound rbxassetid://0: Unable to download sound data (x2) Avoxea 48 — 5y
Ad

Answer this question