I know how to get keys in code. But how do you get the '/' key? I'm making a custom chat gui, and I can't seem to get it to work?
The slash key doesn't trigger the KeyDown event, but it does trigger the KeyUp event. An example of how to do this is below.
local Mouse = game.Players.LocalPlayer:GetMouse() Mouse.KeyUp:connect(function(Key) if Key == "/" then print("The slash key was used") end end)
However, you should really use UserInputService, as using KeyUp means there would be a short delay between when they pressed '/' and when they could type. If you did use UIS, you would use the InputBegan event and read the KeyCode property of the given InputObject.
local UIS = game:GetService("UserInputService") UIS.InputBegan:connect(function(Input) if Input.KeyCode == Enum.KeyCode.Slash then print("The slash key was pressed") end end)