function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.Space then print("hi") end end
You aren't calling the function. So basically, the script can use those lines of code, but not until you say it can. This is in a local script by the way. The efficiant way of doing this is...
game:GetService('UserInputService').InputBegan:connect(function(inputObject) if inputObject.KeyCode == Enum.KeyCode.Space then print("hi") end end)
Refer to http://wiki.roblox.com/index.php?title=API:Class/UserInputService/InputBegan for even more help