Hey, so I have a script that opens a gui and it has a line that stops the gui from opening multiple times and layering, however, when I added that line of code, it stopped the gui opening again after you closed it the first time. This only happens in servers, it works fine in solo, but I understand that solo testing is a lot more lenient. I also believe that it may be a line of code that closes the gui in the local script that may be causing this. I'm just asking for some help for a fix, thanks.
This is the script that opens the gui ontouch
local debounce = true
script.Parent.Touched:connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum ~= nil and debounce == true then
local player = game.Players:FindFirstChild(hum.Parent.Name)
if not player.PlayerGui:FindFirstChild("FrameWork") then -- Checks if the object 'FrameWork' is really inside of the PlayerGui. If it's not then it will pass the if statement.
debounce = false
local Gui = script.Parent.FrameWork:clone()
Gui.Parent = player.PlayerGui
wait(1)
debounce = true
end
end
end)
This script is the response after you click an option, after showing the response, it should close the gui.
text = { "Your loss! You can return at anytime if you change your mind."
}
function Click()
wait()
script.Parent.Visible = false
script.Parent.Parent.Button1.Visible = false
local randText = text[math.random(#text)]
for a=1,string.len(randText) do
script.Parent.Parent.Dialog.Text = string.sub(randText,1,a)..""
wait(.01)
end
wait(5)
local gui = script.Parent.Parent.Parent
gui:Destroy()
end
script.Parent.MouseButton1Down:connect(Click)
The script should open a gui when touched a block then close it after 4 seconds after you pick an option. It does that fine, but it does not re-open after the gui exits. Thanks!

3 comments
Just make the Gui Enabled true or Enabled false and if theres anything particular you need to do then juts make specific frames/boxes visible using :clone() and :destroy() probably won't work as expectes using this method
^^^ has a point.
How would I write that out in the script? Sorry, I don't have much experience with guis