To get straight to the point I just want to know if it’s better to fire remotes based on input that was checked on the client, for example:
local function sendInputToServer(inputObject, gameProcessed)
if inputObject.KeyCode == A certain key then
DoSomething()
elseif inputObject.KeyCode == Another key then
DoSomethingElse()
end
end
UserInputService.InputBegan:Connect(sendInputToServer)
Or if it’s better to fire one remote that sends the input to the server and then the server check what it should do with that input:
local function sendInputToServer(inputObject, gameProcessed)
remoteEvent:FireServer(inputObject.KeyCode)
end
UserInputService.InputBegan:Connect(sendInputToServer)
And then the server would check what key was pressed and decides what to do with it.
The latter implies that every time a player presses a key, the remote would be fired.
What is the point of doing this? To prevent exploiters? What big deal is there if an exploiter changes the hotkey from F to H (for example)? Players will suffer from input lag if you do this.
I thought that it would reduce the amount of remotes I would have (Which doesn’t matter I guess).
And yeah, it wouldn’t matter if an exploiter were to change the hotkey, I just wanted to know how it would affect performance so I guess you’re right about the input lag.
The proper solution would be to parameterize your remote events. For example if the F key is to punch, you could do something like remote:FireServer("punch") when they press F, remote:FireServer("grab") if E is the hotkey to grab, etc. and on the server you might have
local actions = {
punch = function(player: Player)
-- make the player punch...
end
}
then you get that function from the received argument.