of     1   

IosifStaIin
#195908588Thursday, August 11, 2016 2:19 PM GMT

So, I'm trying to add music at the start of the game and end it when I pressed a GUI button. Help?
newdumbman2
#195908929Thursday, August 11, 2016 2:26 PM GMT

local button = --fill this in local music = --fill this in button.MouseButton1Click:connect(function() music:Stop() end)
ArmaVictorem
#195908953Thursday, August 11, 2016 2:26 PM GMT

(whatever var you stored the sound in):Stop() when you click the gui button
IosifStaIin
#195941257Thursday, August 11, 2016 10:23 PM GMT

Wait do I put it in workspace as a local script or a normal script?
IosifStaIin
#195941539Thursday, August 11, 2016 10:27 PM GMT

local button = workspace.IntroGui.MainGameGUI.Play local music = 151489391 button.MouseButton1Click:connect(function() music:Stop() end) (This was in workspace in a normal script)
JoshRBX
#195941623Thursday, August 11, 2016 10:29 PM GMT

Is your intro GUI in the Workspace?
IosifStaIin
#195944396Thursday, August 11, 2016 11:07 PM GMT

Ye
IosifStaIin
#195944528Thursday, August 11, 2016 11:09 PM GMT

local button = workspace.IntroGui.Intro.MainGameGUI.Play local music = 151489391 button.MouseButton1Click:connect(function() music:Stop() end) I fixed the old one because it wasn't going through to the right place. But it still doesn't work.
JoshRBX
#195974390Friday, August 12, 2016 6:37 AM GMT

local button = workspace.IntroGui.Intro.MainGameGUI:Play()
IosifStaIin
#195978925Friday, August 12, 2016 9:52 AM GMT

local button = workspace.IntroGui.Intro.MainGameGUI:Play() local music = 151489391 button.MouseButton1Click:connect(function() music:Stop() end) It still doesn't work ;-;
IosifStaIin
#196119299Sunday, August 14, 2016 2:15 AM GMT

bump
Lord_Narwhal
#196119384Sunday, August 14, 2016 2:16 AM GMT

well look at the logic bro you're trying to call stop on an asset id that shouldn't work in the first play stop the sound's location in workspace Formerly xXTheRobotXx, add 13,349 posts
Lord_Narwhal
#196119419Sunday, August 14, 2016 2:16 AM GMT

"workspace" or whatever the path is Formerly xXTheRobotXx, add 13,349 posts
Julian_Orteil
#196119849Sunday, August 14, 2016 2:22 AM GMT

You can't set an action as a variable, that is why it is not firing.. Also, you need to define the Sound asset as well as the SoundId. You also need to put the GUI into the PlayerGUI, unless if this is a Surface/BillboardGUI. FIX: local button = workspace.IntroGui.Intro.MainGameGUI -- If this is a ScreenGUI, then copy this script into a LocalScript inside StarterPlayerScripts, as well as put the GUI into StarterGUI and define the player. local music = Instance.new("Sound", workspace) local music.SoundId = rbxassetid://[ID here] music:Play() button.MouseButton1Click:connect(function() music:Stop() end) Sidenote: Try to give your variables more meaningful names..these are too generic. Expect nothing, to expect everything
IosifStaIin
#196125056Sunday, August 14, 2016 3:25 AM GMT

Wait why does it have to be in the playerGUI. It's part of the script where it does it for me. local legui = script.Intro:Clone() game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:wait() legui:Clone().Parent = player.PlayerGui end) (I didn't want too many GUIs on my screen)
IosifStaIin
#196125460Sunday, August 14, 2016 3:32 AM GMT

And it didn't work ;-;

    of     1