I get that its something like
function KeyInput() if Enum.UserinputType.Keybaord then end)
~~~~~~~~~~~~~~~~~
But I can't provide a script to something I can't understand
can someone just simply explain how to access key input?
I just want an explanation.
so if key y or anything else was pressed then print ( This key was pressed)
use userinputservice or keydown if its for roblox(keydown is deprecated)
local mouse = game.Player.LocalPlayer:GetMouse() mouse.Keydown:Connect(function(key) --Happening end)
local db = false -- debounce since it's usually necessary local uis = game:GetService("UserInputService") -- get userinputservice uis.InputBegan:connect(function(input, gp) -- when a input from any device happens --input is the argument for the input object that was activated, gp is gameprocessed. if gp then -- if we're in the pause menu or chatting or something where you don't want to pick up a key press, end the function. return else if (input.UserInputType == Enum.UserInputType.Keyboard) and not db then -- if we're on keyboard and debounce is false. if (input.KeyCode == Enum.KeyCode.X) then -- if our input object was the X key. db = true -- debounce is now true. -- do anything wait(3) -- our cooldown for the function to trigger db = false -- let the function trigger once more end end end end)