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

Playable song gui is not working, won't register SongID, how do you make it work?

Hey so I have been trying to take text from a gui, and play a song.

function music() script.Parent.Sound.SoundId = script.Parent.Frame.TextBox.Text
if script.Parent.Sound.SoundId == script.Parent.Frame.TextBox.Text then print("Apple") end script.Parent.Sound:Play() print("Working V2") if script.Parent.Sound.IsPlaying == true then print("Working V3") end end

script.Parent.Frame.TextButton.MouseButton1Click:Connect(music)

This is my script, everything prints, so I don't see the problem. The only problem I can see is in properties the sound object ID does not match the text I entered.

1 answer

✓ Accepted answer

Hi there,

This is because you are simply putting in the ID as a set of numbers. You need to write "rbxassetid://" in your script before your ID so that the song can be looked up and found. It printed everything because it still set the SoundID, but when Roblox went to find your song it couldn't find it (as you needed the rbxassetid:// bit) hence why it didn't play. If you check the output it should tell you it failed to download the song.

function music()
	script.Parent.Sound.SoundId = "rbxassetid://"..script.Parent.Frame.TextBox.Text
	if script.Parent.Sound.SoundId == script.Parent.Frame.TextBox.Text then 
		print("Apple")
	end 	
	script.Parent.Sound:Play() 
	print("Working V2") 
	if script.Parent.Sound.IsPlaying == true then 
		print("Working V3") 
	end 
end

script.Parent.Frame.TextButton.MouseButton1Click:Connect(music)

PS: In future, use a Lua code block in your answer to format your code nicely.

Thanks!

4 comments

0

Sorry, It's not working, I was met with this error! 07:24:36.760 - Failed to load sound rbxassetid://: Unable to download sound data

0

LOL

0

Works fine for me, did you copy what I sent you? Stupid question, is your volume turned up in Roblox and on your PC? Yeah, don't insert rbxassetid:// into the TextBox. Just into the code, you only need to write the ID in the sound box with nothing else. The code will concatenate the "rbxassetid://" bit to your ID.

0

Still not working.

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