So, I want to learn how to execute a chunk of code when a player presses and holds a key but i'm not sure how to approach this, any help?
player = game.Players.LocalPlayer
mouse = player:GetMouse()
mouse.KeyDown:connect(function(key)
print(key:byte())
if key == "f" then
print("wassup")
else
print("hi")
end
end)

3 comments
Impressive, but when I stop holding after the '3 second mark' it continues back where it left off. Very appreciated though!
One more thing, is there way to stop the 'spam' it causes when you have held the key for more then 3 seconds?
To fix that, just add a protection on line 20 that checks if your function has already been activated. Or, at line 23, just reset timePressed and set fPressed to false ;)