Hello there, recently, I've been trying some stuff with UserInputService. I wanted to fire a function while a key is pressed, something like this:
Game:GetService("UserInputService").InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.W then
print("Stuff")
end
end)
The problem is that I want the function to fire while the key is pressed, and that I can just hold the key, and it'll keep printing "Stuff". Now, I have to press W every time I want to pring "Stuff"
Does anyone know how I would do something like this?
Thank you very much for your time!

2 comments
Whoops, that Game with a capital C was a little typo, anyways, thanks for the answer!
I meant capital G not C