Issue opening and Closen my Gui

I have a script that you click the part to open but when I close the Gui it won’t reopen when I click the part here the part script `local ClickDetector = script.Parent.ClickDetector

ClickDetector.MouseClick:Connect(function(PlayerWhoClicked)
local PlayerGui = PlayerWhoClicked:WaitForChild(“PlayerGui”)
local MainFrame = PlayerGui:WaitForChild(“MainFrame”)

print("Part clicked, enabling MainFrame")
MainFrame.Enabled = true

end)
in here the gui script that close the guilocal player = game.Players.LocalPlayer
local playerGui = player:WaitForChild(“PlayerGui”)
local mainFrame = playerGui:WaitForChild(“MainFrame”)
local closeBtn = mainFrame.StartFrame:WaitForChild(“CloseBtn”)

closeBtn.MouseButton1Down:Connect(function()
print(“Close button clicked, disabling MainFrame”)
mainFrame.Enabled = false
end)
`in here video example of what it does

Isnt it easier to use mainFrame.Visible = true?

well, the problem is I have a part that clone the Ui in when the visible set to false
then when I click the part that has the Ui clone script it makes that part of the Ui visible here an example video of what happen when I try that in also when I click the computer screen again it still does the same thing that it did in the video

Have you referenced it right?

yes, it should be referenced right

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