How to make a destroy ui and when pressed button it clones and opens

Ok for a while ive tried to search on how to do this but had no answer all i have done is make a open and close gui

ok this is the close script > script.Parent.MouseButton1Click:Connect(function()

script.Parent.Parent.Visible = false
end)

and this is the open script

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.MonthlyEvents.Visible = true
end)

Are you perhaps looking for the ResetOnSpawn property for ScreenGUIs? Or am I misreading something in your question?

Alright so before the player click the button to open the gui it wont be there but when they open it will be there but when they close it it will be deleted

Couldn’t you just set the visibility of the GUI to false on the Properties menu of the ScreenGUI? This would set the visibility of the GUI when a Player first joins.

I would but i have to make the guis destroy as eventualy it will lag due to my whole game being off uis

I don’t think it will be that drastic. The only times when you’re going to see noticeable performance issues is by having hundreds or even thousands of GUIs.

well it makes sense but i got told by somebody more experienced then me

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.