So, I've been trying to make a computer model in my game that opens up a gui when you click the screen. It's semi-working; I can open it but when I close it and try to open it up again, nothing happens. I'm new to scripting, so it's probably something small I'm missing, but I'm not completely sure what to add to make it continuous? ;3;
Opening screengui code:
function Clicked(Plr) Plr.PlayerGui.GamePasses.Frame.Visible = true end script.Parent.MouseClick:connect(Clicked)
Close button code (in case this is the problem?)
button = script.Parent window = script.Parent.Parent.Parent function onClicked(GUI) window:remove() end script.Parent.MouseButton1Click:connect(onClicked)
--5 window:remove()
The :Remove() function does as it says, removes. You can't set the visibility of something that doesn't exist.
Better to toggle the visibility, as you did with the opening function of the script.