im trying to make a keybind for a gui leaderboard but i get this error message:
PlayerGui.ScreenGui.Frame.LocalScript:10: attempt to index nil with 'keyCode'
Here is the script please help
function PopupGui() if script.Parent.Visible==true then script.Parent.Visible=false else script.Parent.Visible=true end end
game:GetService("UserInputService").InputBegan:Connect(function(key) if Key.KeyCode==Enum.KeyCode.Tab then popupGui() end end)
This worked for me.
local gui = script.Parent local uis = game:GetService("UserInputService") function popupGui() if gui.Visible == true then gui.Visible = false else gui.Visible = true end end uis.InputBegan:Connect(function(input,typing) if typing then return end if input.KeyCode == Enum.KeyCode.Tab then popupGui() end end)