How do i get keyboard input in a plugin?

How do i get keyboard input in a plugin? Remember that there was previously a tutorial by Roblox on this on the now barely usable developer.roblox.com.

you can do

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input) --Player Press A Key
print(input.Keycode) --will print the key that player press

end)


For some reason, that doesn’t work for me. Any idea why? My script is located inside a folder, and I have that exact same code. Script type is serversided