I’m trying to make it so that whenever a player presses the H key a GUI will show up and if you press H again it will close the GUI. The script doesn’t work and nothing shows up on the output.
local userInput = game:GetService("UserInputService")
local frame = script.Parent.Frame
userInput.InputBegan:Connect(function(input,gameProcessed)
if gameProcessed then--Prevents this from running when typing in chat
if input.KeyCode == Enum.KeyCode.H then
frame.Visible = true
end
if input.KeyCode == Enum.KeyCode.H and frame.Visible == true then
wait(1)
frame.Visible = false
end
end
end)