The service literally defines what it means: It detects whatever input a player makes (Inside a LocalScript, that is)
--Server Script
local Input = game:GetService("UserInputService")
Input.InputBegan:Connect(function(input, gameprocessedEvent)
print("test") -- This doesn't work
end)
This code will only run once as Behind said, while this:
--Local Script inside a StarterPack
local Input = game:GetService("UserInputService")
Input.InputBegan:Connect(function(input, gameprocessedEvent)
print("test") -- This doesn't work
end)
Will run and detect whenever a player inputs a certain action