The Input Action System seems to fire more than once on the client at random. The server is fine.
In the example, “GRAB STARTED” and “GRAB ENDED” should output in order each time. Sometimes, “GRAB STARTED” yields a bit before “GRAB ENDED” can run, otherwise “STARTED” will output either way.
This sounds like resimulation is re-firing the IAS events, which is intended behavior (inputs get replayed during resim so the simulation stays consistent). Can you attach a print statement to RunService.Misprediction and see if the client mispredicts before the IAS events fire again?
However, a single press sometimes fires the Pressed event 2 to 3 times. This makes it very difficult to test in Studio.
For actions like toggling lights or enabling sprint, polling InputAction:GetState() every frame just to detect a press feels like overkill. These are one-shot actions, so Pressed should ideally fire exactly once per key press.
Is anyone else experiencing this, or is there a known workaround?
For an easy workaround, put if not RunService:IsResimulating() then return end at the top of your connect function. This can cause mispredictions though, since your client won’t resimulate the results of the function
Seems to have been the root cause. Although I’m not sure why the client would mispredict an input occuring on it’s own client where nothing happens, and I’d appreciate an explanation if you have the time. Until then, I think I’ll stick to using if not RunService:IsResimulating() then return end to resolve this issue. Thank you.
Edit: Also, here’s the print statement if you still need it for anything else, just in case;
inputs.Engine.Pressed:Connect(function()
if not game:GetService("RunService"):IsResimulating() then
print("miss")
return
end
print("eh")
end)
Sometimes a single key press prints ehtwice and miss, and other times it only prints miss . The behavior seems completely random and is very difficult to reproduce consistently.
The misprediction signal (see here) has information about which Instances mispredicted, and why. If you’ve got anything else going on in your game, it could be the cause of the mispredictions (even if it’s unrelated to the input you’re testing)
This is likely expected behavior (unless you’re seeing it in an empty baseplate). I also recommend using RunService.Misprediction to debug why you’re getting a rollback here