I need the sound to also play when they click to close the gui
function close() script.Parent.Parent.Parent:Remove() end script.Parent.MouseButton1Click:connect(close) game.StarterGui.Menu.click:Play() -- the sound
Like what @DarkDanny04 said, you do not use starter gui because that stuff gets cloned into the player gui.
try this:
function close() script.Parent.Parent.Parent:Remove() end script.Parent.MouseButton1Click:connect(close) game.Players.LocalPlayer.PlayerGui.Menu.click.Play()
try this! (I am a newbie at Scripting) put your sound or whatever in SoundService and then put this code
game.SoundService.YourSound.Playing = true
ReplaceYourSound
with the name of the sound you want,
and again I am a newbie and sometimes I just do the simplest things there maybe better scripts than this, but this is all I have to offer.
function close() script.Parent.Parent.Parent:Destroy() -- Remove() is deprecated so use :Destroy() end script.Parent.MouseButton1Click:Connect(close) -- a lowercase c in Connect makes the function deprecated so please capitalize the C game.Players.LocalPlayer.PlayerGui.Menu.click:Play()
If it doesn't work, at the end of the script, try adding a wait() time for however long the song is.