Know if user keyboard is QWERTY or AZERTY

Hey I’m Lap_124, a French roblox developer

I have a problem with a system
I need to know if the keyboard of the player is QWERTY or AZERTY

Maybe I need a special service to fon how to do that

May I ask what your system is? Then we can help further or provide another solution?

It’s a turret system
I want to rotate the turret at left when user pushes A or Q depending of the keyboard

Just script the normal code for inputting a certain key, roblox applies the QWERTY layout for the AZERTY keyboard users. Here:
AZERT and QWERTY keyboard input - Help and Feedback / Scripting Support - Roblox Developer Forum

1 Like

so I must script my system for QWERTY and roblox will apply for AZERTY too ?

There is a method called UserInputService:GetStringForKeyCode() which returns the key you should press if you’re on a non-QWERTY keyboard. For example, in an AZERTY keyboard the A maps to Q in QWERTY. If you tell the player to press Q he’s gonna be pressing the A which is weird, and sometimes won’t remember what certain QWERTY characters map to.

You pass to this function the key you want the player to press if he was using a QWERTY keyboard, and it returns the character in the the equivilent non-QWERTY position. So, say UIS:GetStringForKeyCode(Enum.KeyCode.Q) , returns "A".

You’re not gonna be writing seperate pieces of code for each keyboard layout, but you just change information regarding keys depending on the keyboard used. Rule of the thumb, whenever you include a keycode in a string (for example "Press" .. Enum.KeyCode[key code you chose] .. " to turn turret to the Right"), pass it to GetStringForKeyCode() first, ("Press" .. UIS:GetStringForKeyCode(Enum.KeyCode[key code you chose]) .. " to turn turret to the Right")

8 Likes