Should be fairly simple to try something like this:
local pushEnter, pushCancel
pushEnter = gui1.MouseButton1Click:Connect(function()
--remote:InvokeServer(text)
--same as remote.InvokeServer(remote, text)
gui1.Active = false
gui2.Active = false
textbox.Active = false
local success, result = pcall(remote.InvokeServer, remote, textbox.Text)
if success and result then
closeGui()
--[[
you would not need to do the below if you :Destroy() the gui,
but usually you do not want to do this as it is very easy
to just move it out the way without having to make a new one each time
]]--
pushEnter:Disconnect()
pushCancel:Disconnect()
else
tryAgainText()
gui1.Active = true
gui2.Active = true
textbox.Active = true
end
end)
pushCancel = gui2.MouseButton1Click:Connect(function()
closeGui()
pushEnter:Disconnect()
pushCancel:Disconnect()
end)