Hello DevForum,
I’m trying to make a music player.
This is my current code:
local MusicFrame = script.Parent.Music
local IDBox = MusicFrame.IDBox
local PlayButton = MusicFrame.PlayButton
local Music = workspace.Music.Music
PlayButton.MouseButton1Click:Connect(function()
Music.SoundId = "rbxassetid://"..IDBox.Text
Music:Play()
end)
Script Info: the “Music” Variable is a sound object in workspace
IDBox is a Textbox Object.
PlayButton is a TextButton Object.
Well sure, this does work. So what’s the problem?
The problem is that I believe this is a very inefficient way of making a music player because if the player types any letters into the TextBox then it will error, preventing it from working, same if they input an ID that doesn’t exist.