Hello, I am working a control script for a game I am working on, One of the many features is holding Shift to sprint. The InputEnded function fires extremely easily, you have to hold down shift fairly hard to keep running or it will fire InputEnded even if the Shift key is still very clearly held down. At first I thought this was just an issue with my keyboard but it seems many other people who have play tested the controls also experience this issue. It can be quite frustrating when running away from or chasing someone. I didn’t see any existing posts about this so I decided to start one to see if anyone else has had this issue and if there is a way around it.
Could you show the relevant code and/or link a game with the issue?
I think it could only be a hardware problem (your keyboard) or something wrong with your code. I’ve never experienced anything like this with InputEnded.
It also works fine for me, must be your keyboard
Here is the simplified code
game:GetService("UserInputService").InputEnded:Connect(function(Key, gameProccessed)
if (Key.KeyCode == Enum.KeyCode.LeftShift or Key.KeyCode == Enum.KeyCode.RightShift) and gameProccessed == false then
shiftend()
end
end)
What about the shiftend() function there? Also, a link to a game with this problem would definitely be helpful. I could confirm or deny that it’s a problem with your keyboard.
I can’t share it unfortunately, it’s still in the works and only the game’s developers can access it. The shiftend function is a function that just handle animations and deceleration of the player’s walkspeed. I tested with a print above the shiftend() call and it printed every time the sprint stopped with the shift key still down.
You could just move the sprint script over to a blank baseplate. I have no other ideas besides checking if the error is replicated on my end.
Alright I’ll see if I can set up something real quick
This is just a simplified run script but I was able to replicate the same issue the actual script has on my end
I was able to sprint uninterrupted for over thirty seconds. It must be a problem with your keyboard.
Here’s a video with proof if you’d like:
Sprint_test.wmv (4.3 MB)
Alright, I still think it’s a bit odd for it to be a keyboard issue since so many people had that issue when playtesting but I appreciate you testing it yourself.