I tried making a game that gives you points for walking. It does not work, because 'input' is a nil value in the server script. Here's the script:
LocalScript (in StarterGui):
local uis = game:GetService("UserInputService")
uis.InputBegan:connect(function(input)
game.ReplicatedStorage.addValueToSteps:FireServer(input)
end)
Server Script (in ServerScriptService):
game.ReplicatedStorage.addValueToSteps.OnServerEvent:Connect(function(client, input)
if input.KeyCode == Enum.KeyCode.A or Enum.KeyCode.S or Enum.KeyCode.W or Enum.KeyCode.D then
local steps = client.leaderstats.Steps
local char = client:FindFirstChild("Character")
if char then
local walkSpeed = char.Humanoid.WalkSpeed
steps.Value = steps.Value + walkSpeed / 10
end
end
end)
The problem is that it is stating that, on line 2, the 'input' parameter in the server script equals a nil value. What is happening with this?

2 comments
is it possible to increase a player's steps by 1 for every half second that theyre walking? (thats the purpose of me making these scripts)
just divide it by two so in one full step they get the full value