assert((game:GetService("\082\117\110\083\101\114\118\105\099\101")):IsClient(),"\075\101\121\098\111\097\114\100 \099\097\110 \111\110\108\121 \098\101 \117\115\101\100 \102\114\111\109 \099\108\105\101\110\116")local G={}local t=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local q={}local U=Enum.UserInputType.Keyboard local O=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")local j=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")G.KeyDown=O.Event G.KeyUp=j.Event function G.IsDown(t,G)return q[G]==true end local function c(G,t)if t then return end if G.UserInputType==U then local t=G.KeyCode q[t]=true O:Fire(t)end end local function L(G,t)if t then return end if G.UserInputType==U then local t=G.KeyCode q[t]=false j:Fire(t)end end t.InputBegan:Connect(c)t.InputEnded:Connect(L)return G
--[[
	
	local keyboard = require(this)
	
	METHODS:
		
		(IsDown)
		
		Boolean isDown:  keyboard:IsDown(KeyCode key)
		
	
	EVENTS:
	
		(KeyDown, KeyUp)
		
		keyboard.KeyDown(KeyCode key)
		keyboard.KeyUp(KeyCode key)
	
--]]

assert(game:GetService("RunService"):IsClient(), "Keyboard can only be used from client")

local Keyboard = {}

local userInput = game:GetService("UserInputService")

local isDown = {}

local keyboardInput = Enum.UserInputType.Keyboard

local onKeyDown = Instance.new("BindableEvent")
local onKeyUp = Instance.new("BindableEvent")

Keyboard.KeyDown = onKeyDown.Event
Keyboard.KeyUp = onKeyUp.Event

function Keyboard:IsDown(keyCode)
	return (isDown[keyCode] == true)
end

local function InputBegan(input, processed)
	if processed then
		return
	end
	if input.UserInputType == keyboardInput then
		local key = input.KeyCode
		isDown[key] = true
		onKeyDown:Fire(key)
	end
end

local function InputEnded(input, processed)
	if processed then
		return
	end
	if input.UserInputType == keyboardInput then
		local key = input.KeyCode
		isDown[key] = false
		onKeyUp:Fire(key)
	end
end

userInput.InputBegan:Connect(InputBegan)
userInput.InputEnded:Connect(InputEnded)

return Keyboard
