I know that the KeyUp and KeyDown is deprecated so I used the way below, but I don't know if there is an onKeyRelease or a way to stop the function below.
Is there an onKeyRelease or Key up I can use with the UserInputService? or is there an other way I can stop it?
enabled = false
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.R then
enabled = true
repeat
repetition()
wait(1)
until enabled == false
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
function repetition()
print('R is being pressed')
end

2 comments
game:GetService("UserInputService").InputEnded
thanks