What have I done wrong in this LocalScript? It is supposed to open and close a GUI however, the UI only opens and does not close.
game:GetService("UserInputService").InputBegan:Connect(function(Input, IsTyping)
local open = false
local close = true
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode.H then
if open == false then
OpenGive()
open = true
close = false
elseif open == true then
CloseGive()
open = false
close = true
end
end
end)
The OpenGive and CloseGive functions are just UDim2 Values and a statement that prints what is happening.

4 comments
p.s Just change the M to H I forgot about that, because I took it from a game I'm making but a lot was changed so I just forgot.
Sorry, I only just say this and thanks for your help, it worked!
saw*
I've marked your answer as the solution.