I'll try to be as elaborate as possible. I've been working on a ScreenGui that opens up to a textbox to enter an audio ID. I'm trying to figure out how to play music from the block itself and not the Game.Workspace. I tried this script but the audio, once the game was launched, played, then after a few seconds another one started and another one and it was playing like 150 of the same song, but when I entered the Id and clicked enter I could, barely through all the other songs, hear one of them coming from the block.

local button = script.Parent local box = button.Parent.MusicBox local music = game.Workspace.musicblock.Music

button.MouseButton1Click:Connect(function() music.SoundId = "rbxassetid://"..box.Text music:Play() end)

musicblock is just the part the sound is located in, musicbox is the textbox to enter the ID. Im new to scripting so if there is a better way to do this feel free to tell me

5 comments

0

Do you want the player to hear it only or all players in the game?

0

all the players in the game, its a stereo system im making and it works but multiple songs are starting when the game launches/script activates, its like the script keeps repeating itself and starting tons of songs when an id is entered.

0

The script will not repeat itself so it might be in your other sciprs.

0

It's really strange. The script is starting up as soon as the game launches and it starts like 50 songs of whatever ID was left in the GUI from the previous use.

0

I figured out the problem. I still had sound in the GUI itself and not in the block, my bad. Have a good day and thanks for the help!