[Solved by Kiriot22]
Basically I am making a script where when you press enter it will do something. I am using UserInput to do this but for some reason when I press enter it does nothing. I have no errors or warnings in the console. I am using a local script. The code is:
game:GetService("UserInputService").InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.Return then print("Hey! You pressed enter!") end end)
Any suggestions? It's in workspace but I think it might need to be somewhere else.
Pay attention to capitals, and make sure you are using a local script. :connect
should be :Connect
if the code is still not working, make sure you have the local script somewhere where it will be run.
game:GetService("UserInputService").InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.Return then print("Hey! You pressed enter!") end end)
If this helped please accept the answer so we can both get rep+ :)
It doesn't work because LocalScripts don't run in workspace (for obvious reasons). You should put it into StarterPlayerScripts or StarterCharacterScripts or such.