I added a part in workspace, then a surface gui, then a textbox in the surface gui. I put in the textbox "Touch me to play music"
I added a script in the part (not in the surface gui, or the textbox). This is the script I added. I named the part "MusicPlayer"
So what I am basically trying to do here is to play a song ONCE and then it ends after. Here is the script:
`` if game.Workspace.MusicStarter.Touched.connect(musiccircuit)then function musiccircuit() Instance.new("Sound", game.Workspace.MusicStarter)--Added a sound in the MusicStarter part local music = game.Workspace.MusicStarter.SoundId("rbxassetid://238976867") music.Play("rbxassetid://238976867") wait(120) --The length of time to play the music before it ends. end end
`` if game.Workspace.MusicStarter.Touched.connect(musiccircuit)then function musiccircuit() Instance.new("Sound", game.Workspace.MusicStarter)--Added a sound in the MusicStarter part local music = game.Workspace.MusicStarter.SoundId("rbxassetid://238976867") music.Play("rbxassetid://238976867") wait(120) --The length of time to play the music before it ends. music:Stop()