local Keybind = script.Parent.Input
local SkillName = script.Parent.SkillName
local UIS = game:GetService(“UserInputService”)
local Keybinding
local KeyCombinations
local RS = game:GetService(“RunService”)
local CTRL = false
Keybind.Focused:Connect(function()
Keybinding = true
end)
UIS.InputBegan:Connect(function(Input)
if Keybinding then
if Input.UserInputType == Enum.UserInputType.Keyboard then
if Input.KeyCode == Enum.KeyCode.LeftControl then
CTRL = true
end
end
end
end)
Keybind.FocusLost:Connect(function()
Keybind.Text = Keybind.Text:sub(1,3):upper()
KeyCombinations = string.split(Keybind.Text,"")
if CTRL then
table.insert(KeyCombinations, “CTRL”)
end
local KeyString = “”
for i, Key in pairs(KeyCombinations) do
if i ~= #KeyCombinations then
KeyString …= KeyCombinations[i]…" + "
elseif i == #KeyCombinations then
KeyString …= KeyCombinations[i]
end
end
Keybind.Text = KeyString
Keybinding = false
CTRL = false
end)
Both script and typed code have been provided. Now I’d like to explain what it is I am trying to do. I’d like “CTRL” to be typed out when players have the textbox focused and input LeftControl. And as you can see from my script, I was not able to script a way for “CTRL” to be typed out upon input without it conflicting with previously typed characters. It also does not display to the player that they have typed CTRL and simply adds the “CTRL” string at the end of the text after the textbox loses focus. Which of course, I can understand why it’s doing this, but I’m just not able to figure out how to have CTRL literally typed like every other key would be.
How should I go about this? Any advice? Would appreciate any feedback that can be given.