how to make a function run when a key is pressed in roblox studio 2020 code example
Example: roblox key pressed script
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.KeyDown:connect(function()
print("Pressed a key.")
end)