Disable an input function

Hey there, I don’t do much scripting and I’m currently working with a script a friend wrote for me. To activate the frame, I have to hold Tab, since the frame is only visible while Tab is being held down. Could someone fix this?

local plr = game.Players.LocalPlayer
local input = game:GetService("UserInputService")

local board = script.Parent.Board

input.InputBegan:connect(function(key,processed)
	
	if processed then return end
	if key.KeyCode == Enum.KeyCode.Tab then
		board.Visible = true
	end	
	
end)

input.InputEnded:connect(function(key,processed)
	
	if processed then return end
	if key.KeyCode == Enum.KeyCode.Tab then
		board.Visible = false
	end	
	
end)

What do you want to “fix”? If you want the board frame to be toggled instead of press and hold you can change the code to look like this:

local plr = game.Players.LocalPlayer
local input = game:GetService("UserInputService")

local board = script.Parent.Board

input.InputBegan:connect(function(key,processed)
	
	if processed then return end
	if key.KeyCode == Enum.KeyCode.Tab then
		board.Visible = not board.Visible
	end	
	
end)
--nix InputEnded. It is not needed