How to detect when an has started pressing "/"

Hello!
I was making a chat system and I wanted it to be opened when you use press “/”. So I tried this:

--[[
UserInputS = game:GetService("UserInputService")
Typer = Typer TextBox
MainF = Frame wich contains all the chat
]]

UserInputS.InputBegan:Connect(function(input, impedido)
	if input.KeyCode == Enum.KeyCode.Slash and not impedido then
		Typer:CaptureFocus()
		Typer.Text = ""
		MainF:TweenPosition(UDim2.new(0,10,0,50), nil, nil, 0.5, true)
	end
end)

I tried it and I realized it don’t works. Then I toke a look and I realized that the Enum.KeyCode.Slash, had a weird description:


So I decided open a emty place wich prints my inputs and I recibed that when I pressed slash, It printed Enum.KeyCode.LeftShift and Enum.KeyCode.Seven, wich is the combination of keys you need to pres on the spanish keyboard (the one I use) to write “/”.
So the UserInputService records the keys you press, no the ones you are typing
So do anyone know how to run a function when you press the Slash (“/”) key on the keyboard?

Does this work?

UserInputS.InputBegan:Connect(function(input, impedido)
	if impedido then
		return
	end
	local pressedSlash = input.KeyCode == Enum.KeyCode.Slash
	local pressedCorrectKeyCombination = input.KeyCode == Enum.KeyCode.Seven and UserInputS:IsKeyDown(Enum.KeyCode.LeftShift)
	if pressedSlash or pressedCorrectKeyCombination then
		Typer:CaptureFocus()
		Typer.Text = ""
		MainF:TweenPosition(UDim2.new(0,10,0,50), nil, nil, 0.5, true)
	end
end)
1 Like

It would work but only on spanish keyboard. I want it to work on every keyboard.
(I don’t neither want to make a if cheking each lenguage on the world)