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
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()
It did not work
:Play() - Sound Instances can only be heard in physical environments; you must have it in workspace. :Remove() is deprecated too, use :Destroy().
:Remove() is deprecated, use :Destroy(). Lowercase :connect is deprecated, use :Connect().
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.
Does this worK?
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Just a heads up, you never address the StarterGui, since that stuff automatically gets cloned to the PlayerGui, and thats where you see it.