I am having a problem with a frame changing visibility randomly. For making a game Menu, I want the frame to be invisible when the game launches.
I have done some testing and realized that when I close the game with the frame open(visible), it appears invisible(how it's supposed to be) and if I close the game with the frame closed(invisible), it appears visible at the start of the game.
local Button = script.Parent local Frame = script.Parent.Parent.Frame Frame.Visible = false function onClick() if Frame.Visible == true then Frame.Visible = false elseif Frame.Visible == false then Frame.Visible = true end end Button.MouseButton1Click:Connect(onClick) while true do onClick() end
I have no idea how to fix this, and it's bothering me very much. If you have a solution, I would be grateful if you would share it with me, thanks in advance.
I don't think you need lines 14 -16. That loop would be flicking it on and off instantly.