Hi, I have this function in a local script here:
UserInputService.InputBegan:connect(function(key)
game:GetService("RunService").RenderStepped:connect(function()
if(key.KeyCode == Enum.KeyCode.W)then
remote:FireServer('W')
end
if(key.KeyCode == Enum.KeyCode.S)then
remote:FireServer('S')
end
end)
end)
Since I added in renderstepped (I want it to update something every frame), the if statements would be run even when I am no longer holding down the W / S keys. Any explanations and solutions? Thanks in advance.

4 comments
you're connecting to the event each time InputBegan is fired. the event fires every render cycle.
You really need to think about how practical doing this is on a game, all clients firing the server using RenderStepped.
I had some doubts, but I don't know any other way to connect the inputbegan from a local script to a server script. Is there a more efficient way?
Fire on input start and input stop, rather than every frame.