Hello i was wondering how to detect if somebody has clicked a capital letter on their keyboard with UserInputService. does anybody know how to do this i have no idea plz help
Unfortunately, I don’t know function that can determine which letter you pressed, but I wrote a simple version of a possible check. It doesn’t work very well. When you hold down the Shift key, the letter case changes.
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
local Letter = input.KeyCode
-- Check if shift is down
if UIS:IsKeyDown(Enum.KeyCode.LeftShift) or UIS:IsKeyDown(Enum.KeyCode.RightShift) then
print("Capital letter pressed:", Letter)
else
print("Default letter pressed:", Letter)
end
end
end)
I will be very glad if you find a better answer!
Enum.KeyCode.CapsLock
Should be added too.
Thank you so much it works, this will help a lot with my project