I'm trying to get my character select GUI to disappear once a character is selected, but this script doesn't seem to work
script.Parent.MouseButton1Click:connect(function() local Cover = game.StarterGui.CharSelect.BlackScreen:WaitForChild('BookHolder') Cover.Visible = false game.StarterGui.CharSelect.BlackScreen.BackgroundTransparency = 1 end)
BookHolder is the frame holding the Button that is to be pressed
I've tried to set it as "Player.PlayerGui." but got no luck as it said that it couldn't find "Player" Should the code above be on a local or normal script?
this is how it is opened
script.Parent.ClickDetector.MouseClick:connect(function(Player) Player.PlayerGui.CharSelect.BlackScreen.BackgroundTransparency = 0 Player.PlayerGui.CharSelect.BlackScreen.BookHolder.Visible = true end)
this opens it fine, just don't know why it isn't closing
Thanks for help in advanced :)
Simple error, this is because in your first code, the part where it closes you are "closing" the one in StarterGui
. You will not see the change if you edit that one!
In your second code you showed, you did it correctly by editing the one in the players PlayerGui
. You need to do the same thing you did in that one to the first one, the one where you closed.
All in all, your problem is that you're editing the wrong Gui. Edit the one in PlayerGui
instead of StarterGui
and you should be fine!