Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
15

Why is the PlayerMouse not firing KeyDown when F key pressed? [closed]

Asked by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

This used to work fine, but last week or so I noticed that the F key control wasn't working in my game.

I just now did a simple test:

function keydown(k)
    print(k);
end

m = game.Players.LocalPlayer:GetMouse();
m.KeyDown:connect(keydown)

... and "f" wasn't printed when I pressed the 'f' key (though everything else works).


Why is the f key now protected?

Can I do something to get around this? Will using a tool work? Can I do that will hiding the ROBLOX tool GUIs and avoiding other UI annoyances?

Locked by adark, Spongocardo, and M39a9am3R

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

2 answers

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

I know this question is super old, but since it isn't locked:

You can use the UserInputService now to get around this:

local uis = game:GetService("UserInputService")

uis.InputBegan:connect(function(inst)
    if inst.KeyCode == Enum.KeyCode.F then
        print("f key pressed")
    end
end)
Ad
Log in to vote
0
Answered by
Legojoker 345 Moderation Voter
9 years ago

To get around protected keys, you will unfortunately have to use KeyUp. This is what I did when I wanted "/" to be a key that worked in my game. Sorry if you REALLY want to use KeyDown for "f," this probably wasn't the answer you wanted lol. If that is the case then I suggest sending a message to roblox about your request to fix these protected keys. (And yes, "f" is one of my hotkeys in my game too so "f" will work with KeyUp, but I figured I'd use "/" as an example xD)