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

Is it possible to detect the cmd key on mac?

Asked by
Aimarekin 345 Moderation Voter
5 years ago
Edited 5 years ago

Is it possible to detect the command key on mac (https://en.wikipedia.org/wiki/Command_key) ?

I thought maybe the Enum.KeyCode.LeftControl and Enum.KeyCode.RightControl would work, but they don't. Possible?

0
UserInputService uses this keyboard https://en.wikipedia.org/wiki/Space-cadet_keyboard hiimgoodpack 2009 — 5y

1 answer

Log in to vote
1
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
5 years ago

I'm not sure if you can detect that specific key or not as I've never owned a mac, but you can make a script which prints the value of every key you press, then press the cmd key and see if it printed anything.

game:GetService("UserInputService").InputBegan:Connect(function(iobj, gp)
    if gp then return end
    print(iobj.KeyCode, iobj.KeyCode.Value)
end)
0
Didn't thought on doing that. And, it prints Left and Right Control (Yeah, I have a Mac and it sucks for game dev). Maybe the error is in my script.. Thanks! Aimarekin 345 — 5y
Ad

Answer this question