This bug only appears to happen in studio.
While holding an arrow key, after approximately 0.5 seconds the InputObject’s UserInputState will rapidly change between End and Begin (in the same frame) many times per second until another arrow key is pressed or the original arrow key press is stopped.
Example place demonstrating this bug:
Hold down the up arrow and watch the output (while running the game in studio), the UserInputState will change from Begin to End many times per second.
Code used in example place
local ContextActionService = game:GetService"ContextActionService"
local RunService = game:GetService"RunService"
local RenderStepped = RunService.RenderStepped
local IsHolding = false
ContextActionService:BindActionAtPriority("Hold",function(_,State,Input)
if State == Enum.UserInputState.Begin then
if IsHolding then
print"already holding"
return Enum.ContextActionResult.Pass
end
IsHolding = true
local ChangedSignal = Input:GetPropertyChangedSignal"UserInputState"
local Con
Con = ChangedSignal:Connect(function()
print(os.clock(),"-",Input.UserInputState)
if Input.UserInputState == Enum.UserInputState.End then
local InnerCon
InnerCon = ChangedSignal:Connect(function()
InnerCon:Disconnect()
end)
RenderStepped:Wait()
if Input.UserInputState == Enum.UserInputState.End and InnerCon.Connected then
print"input finished"
Con:Disconnect()
IsHolding = false
end
if InnerCon.Connected then
InnerCon:Disconnect()
end
end
end)
print(os.clock(),"-",Input.UserInputState)
end
return Enum.ContextActionResult.Pass
end,false,Enum.ContextActionPriority.High.Value+10,Enum.KeyCode.Up)
This is the output I got after holding the up arrow key for approximately 1 second.
473697.064993 - Enum.UserInputState.Begin
473697.5645211 - Enum.UserInputState.End
473697.565254 - Enum.UserInputState.Begin
473697.5975291 - Enum.UserInputState.End
473697.5982472 - Enum.UserInputState.Begin
473697.6318508 - Enum.UserInputState.End
473697.6325546 - Enum.UserInputState.Begin
473697.6653624 - Enum.UserInputState.End
473697.6661368 - Enum.UserInputState.Begin
473697.6977104 - Enum.UserInputState.End
473697.698467 - Enum.UserInputState.Begin
473697.7308369 - Enum.UserInputState.End
473697.7315519 - Enum.UserInputState.Begin
473697.7638633 - Enum.UserInputState.End
473697.7645812 - Enum.UserInputState.Begin
473697.7978693 - Enum.UserInputState.End
473697.7985599 - Enum.UserInputState.Begin
473697.830762 - Enum.UserInputState.End
473697.8314158 - Enum.UserInputState.Begin
473697.867414 - Enum.UserInputState.End
473697.8680499 - Enum.UserInputState.Begin
473697.8975887 - Enum.UserInputState.End
473697.8982908 - Enum.UserInputState.Begin
473697.9306515 - Enum.UserInputState.End
473697.9313467 - Enum.UserInputState.Begin
473697.9636505 - Enum.UserInputState.End
473697.9644495 - Enum.UserInputState.Begin
473697.9976086 - Enum.UserInputState.End
473697.9984759 - Enum.UserInputState.Begin
473698.0306616 - Enum.UserInputState.End
473698.0314698 - Enum.UserInputState.Begin
473698.0476703 - Enum.UserInputState.End
input finished
I’m not sure when this bug started, but I know its existed for at least the past month and a half (when I discovered it).