Get special and language characters

After many days of suffering, I have realized that I need help, so the problem is:
How do I get the exact input from a keyboard?

This includes special characters ($, @ or ~), but it also includes unique language keys: (ß, Ě, Ç, Ŝ, Đ) that cannot be accessed by specific keyboards (not going with chinese or russian keyboards, that for me is impossible)

Solutions I have tried

  1. Using a Textbox which works but this is for a plugin and I prefer not to go that way.
  2. Detect multiple keys with InputBegan to get special characters (doesn’t comply with the languages part, it’s my last bet)
  3. Record the keys (doesn’t comply with the language part either)

What do you mean expect input? You can check the KeyCode enums.
If you do wanna check that an input IS NOT a special character you can use this.

local keycodes = {
	"A",
	"B",
	"C",
	"D",
	"E",
	"F",
	"G",
	"H",
	"I",
	"J",
	"K",
	"L",
	"M",
	"N",
	"O",
	"P",
	"Q",
	"R",
	"S",
	"T",
	"U",
	"V",
	"W",
	"X",
	"Y",
	"Z"
}
game:GetService("UserInputService").InputBegan:Connect(function(Input)
	for _,v in keycodes do
		if Input.KeyCode == Enum.KeyCode[v] then
			print(true)
		else
			print(Input.KeyCode)
		end
	end
end)

Works with some languages, but there would be no way to return the german “ß” with some keyboards like the English one (What the Enums are based on)

It would return which input on the keyboard that was pressed.
for example pressing ال on the arabic language will return H and G. That’s the only way to check special language characters.
image
This is the same case for :GetMouse()

1 Like

Hmm… looks like it would work.

Before taking this as a solution, is there an easier way to do this without a keys combination table? (like the TextBox one)

Yes but you would to replace the keys in table with enums instead.

game:GetService("UserInputService").InputBegan:Connect(function(Input)
	if Input.KeyCode == table.find(keycodes, Input.KeyCode) then
		print(true)
	end
end)

Or are you talking about a textbox?

game:GetService("UserInputService").InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode[Textbox.Text] then
		print(true)
	end
end)

It was the part about the special characters but I already found a way, thanks

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.