Hiya fellow Devs. So I’m currently making an anti Copy Paste script which kicks you after pressing Ctrl + V for my game to prevent spamming and I’ve succeeded making this work for only Windows keys. If you were on Mac, Command is the equivalent to Ctrl which means it won’t detect it when you copy-paste.
Why not just delete duplicate chat messages? Either way, I believe the command key is Enum.KeyCode.LeftSuper
for Mac.
If that doesn’t work, you can try Enum.KeyCode.LeftMeta
maybe? I don’t use a Mac, so I can’t really test these.
Actually, you can find out yourself by running this code in test mode and looking at the output as you press the key:
local userInputService = game:GetService('UserInputService')
userInputService.InputBegan:Connect(function(key)
print(key.KeyCode.Name)
end)
Thank you for those tips, I’ll try them out later (unfortunately I don’t own a mac so I can’t view what key it is).
Hello! I know this is an old post so I’m writing this in case anybody needs help in the future and comes here.
I just tested the keycodes on my MacBook Pro, although it’s a relatively modern version with an M1 chip so I’m not sure if older MacBooks have different keyboards or codes.
This is purely from my testing and not from any documentation or other official sources.
-
Both the left command button and the right command buttons were
Enum.KeyCode.LeftControl
, interestingly (is this a bug?) -
The left control button was
Enum.KeyCode.LeftControl
, and there is no right control button -
The left option button was
Enum.KeyCode.LeftAlt
-
The right option button was
Enum.KeyCode.RightAlt
-
Everything else on the keyboard is the same as Windows
-
And just in case anybody needs it, clicking the trackpad with one finger had an InputUserType of
Enum.UserInputType.MouseButton1
(not a KeyCode) -
Clicking the trackpad with two fingers was an
Enum.UserInputType.MouseButton2
Hope this helps!