So I am trying to do a script (located in ServerScriptService) that detects if a key is pressed so it will call a function, but I don't know how to get the name of the player who pressed it.
game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.R then
print("fireball pls")
end
end)
I can't use LocalPlayer since it's a server-sided script.

1 comment
This won't function either way. This service is client-side only, as stated in it's documentation. I suggest you use a RemoteEvent/Function, with a parallel cooldown