hi!! ive been trying to make a gui that opens with "e", and closes with "e". with this code ive made so far, ive been able to get it to open with "e", but not to close the key is pressed again. any help would be appreciated!!
local debounce = false
local GUI = script.Parent
local uis = game:GetService("UserInputService")
GUI.Visible = false
local GUIOpenKeyCode = Enum.KeyCode.E
uis.InputBegan:Connect(function(input)
if input.KeyCode == GUIOpenKeyCode then
GUI.Visible = true
end
end)
uis.InputBegan:Connect(function(input)
if input.KeyCode == GUIOpenKeyCode then
if not debounce then
debounce = true
wait(2)
end
end
end)
local GUICloseKeyCode = Enum.KeyCode.E
uis.InputBegan:Connect(function(input)
if input.KeyCode == GUICloseKeyCode then
GUI.Visible = false
end
end)
** You are now Level 1! **