local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.KeyDown:connect(function()
print("Pressed a key.")
end)
roblox key pressed script
local UserInputService = game:GetService("UserInputService")
local Key = Enum.KeyCode.WhateverKey
UserInputService.InputBegan:Connect(function(InputObject, GameProcessedEvent)
if GameProcessedEvent then return end
if InputObject.KeyCode = Key then
print("Player pressed "..InputObject.KeyCode)
end
end)