UserInputService isn't working for me?

I started scripting and learning a month or two ago, and I have come across an issue.

Why does this script not work? I believe it is all correct, and I found a bug by myself and fixed it.

UserInputService = game:GetService("UserInputService")

UserInputService.InputBegann:Connect(function(input,gameProccesedEvent)
	if input.KeyCode == Enum.KeyCode.R then
		warn("R was pressed")
	end
end)

I really don’t understand any output either.

Did you put this in a local script? User Input Service doesn’t work on server scripts.

It’s either that you’re using this in a regular script, in which case make it a localscript. Or because you wrote InputBegan as InputBegann

Oops! My mistake. :man_facepalming: That’s the problem.

After changing to a LocalScript and changing it to Began, this error is here- Requested module experienced an error while loading - Client

You don’t require any modules so I think it’s coming from an outdated plugin or another script

Also, make sure the Localscript is in somewhere that it can run, I would recommend StarterPlayer → StarterPlayerScripts

1 Like

I believe it was a very outdated plugin which I just updated, and it now works! Thanks!