I’m trying to create a plugin that keeps track of your studio history. By doing so, I need to disable the default Roblox undo & redo systems by calling ChangeHistoryService:SetEnabled(false) and implementing my own.
Now with this, there is a problem. Whenever I press Control and Q or Y nothing happens. Control + Q will be a quick way of removing your History in case of any errors / spams. Control + Z seems to be working fine though. I have tried using other keys, like Control + T / R / E / X / L and so on. Some seem to be working while others don’t.
On another test, some InputObjects seemed to have changed their position, first being Q and the second being LeftControl, though I first pressed Control and then Q.
Is there anything I can do to fix this? Should I rely on the order that the users press them? I am confused and would need some help.
Here is the script:
local historyEvent = script.Parent.HistoryEvent
UserInputService.InputBegan:Connect(function(input, gameProcessed)
local keysDown = UserInputService:GetKeysPressed()
---------------------| DEBUG |----------------------
local keyNames: {string} = {}
for i, key in pairs(keysDown) do
table.insert(keyNames, tostring(key.KeyCode.Name))
end
print(table.concat(keyNames, ", "))
----------------------------------------------------
if #keysDown < 2 then return end
local k1, k2, kc = keysDown[1], keysDown[2], Enum.KeyCode
if (k1.KeyCode == kc.LeftControl or k1.KeyCode == kc.RightControl) then
if k2.KeyCode == kc.Z then
historyEvent:Fire("undo", 1)
elseif k2.KeyCode == kc.Y then
historyEvent:Fire("redo", 1)
elseif k2.KeyCode == kc.R then
history = {}
for i, v in pairs(newFrame.ScrollingFrame:GetChildren()) do
if v:IsA("Frame") then
v:Destroy()
end
end
end
end
end)
Since it’s a plugin this is inside a Server Script.
Any help would be greatly appreciated! 
Tried running the code myself, the issue is just studio keybinds. If you have a keybind already set for that command, it isn’t detected. There doesn’t seem to be any way of getting around this, as neither InputBegan not GetKeysPressed can detect it.
The issue isn’t GetKeysPressed() it’s that Studio already consumes certain Ctrl combinations before your plugin sees them. Keys like Ctrl+Y, Ctrl+Q, Ctrl+Z are bound to internal Studio actions, so the input never reaches your script consistently. That’s why some combinations work and others don’t.
You shouldn’t rely on GetKeysPressed() or key order for this. For plugins, the correct way is to use plugin hotkeys:
plugin:CreatePluginAction(
"CustomRedo",
"Redo",
"Redo history",
"",
false,
Enum.KeyCode.Y,
Enum.ModifierKey.Control
)
Plugin actions bypass Studio’s input handling and will fire reliably for Ctrl combinations.
Hope this helpss 
Sorry for the late reply!
I have watched some tutorials and it seems that you need to need to assign keyboard shortcuts yourself. I tried this myself with the code you provided and nothing seemed to work. One thing I would like to point out is that the ModifierKey is actually Ctrl, not Control. Is there a way to assign default shortcuts through Scripts?
Sorry about that, man. I am on my custom computer, so I have Control instead of Ctrl also. This isn’t an issue with GetKeysPressed(). Studio is capturing some Ctrl shortcuts before your plugin can read them. Keys like Ctrl+Y, Ctrl+Q, and Ctrl+Z are already used by Studio, so the input doesn’t reliably reach your script. That’s why some combinations work, and others don’t, and why the key order can look strange.
For plugins, the better approach is to use plugin actions instead of detecting Ctrl combos yourself:
plugin:CreatePluginAction(
"CustomRedo",
"Redo",
"Redo history",
"",
false,
Enum.KeyCode.Y,
Enum.ModifierKey.Control
)
Plugin actions bypass Studio’s shortcut handling and will trigger consistently.
Hope this helps, if you need more help lmk lol 
Sorry for the late response.
I get what you’re saying, but after looking at some tutorials I found out that you need to assign the keys yourself from Studio Settings. I don’t think plugin actions provide a way for you to setup default key combinations, though I could be wrong. I am not very documented on plugins.
Though again, I tried to use your code but nothing prints out in the output, as you’ll see:
-- code here
local redoAction = plugin:CreatePluginAction(
"CustomRedo",
"Redo",
"Redo history",
"",
false,
Enum.KeyCode.Y,
Enum.ModifierKey.Ctrl
)
newAction.Triggered:Connect(function()
-- Nothing happens; that is because the user has to go set up their own keybinds from the settings
print("Action triggered!")
end
Is there something I’m doing wrong? Is there a way to bind default key combinations?