This is my code so far:
function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.32 then print("Space was pressed") end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
Erroring at line 2. Dont know how to refer to a number.
The space bar has a value of 32, not a name. Use this page as a reference:
function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.Space then print("Space was pressed") end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)