I’m making a system which replicates the building tools in studio to work in-game, and I’m adding all the shortcuts. Usually Ctrl+R rotates the part and Ctrl+T tilts it, but for some reason Ctrl+T won’t work with UserInputService. I’m not sure if this is a bug or if I’m doing something wrong, but when using the code below, it only prints “Ctrl+R” and not “Ctrl+T”, at first I thought it was to do with it being a game processed event or something like that, but even with it removed from the code it still doesn’t work.
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input)
if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then
if input.KeyCode == Enum.KeyCode.R then
print("Ctrl+R")
elseif input.KeyCode == Enum.KeyCode.T then
print("Ctrl+T")
end
end
end)
Does it work in game? Or is a studio only issue?
Can you add more print statements? Something like:
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input)
if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) then
print("Control is being pressed.")
else
print("Control is not being pressed.")
end
if input.KeyCode == Enum.KeyCode.T then
print("T pressed.")
end
end)
It should print:
"Control is being pressed."
"T pressed."
If it doesn’t and the code works in game then it’s a studio fault.
But I still don’t understand how I can still use the other shortcuts with UserInputService, like Ctrl+R still works in-game even with the studio shortcut:
Probably because as Control is a function key so when you hold it down Roblox studio starts detecting all keystrokes and so stops actions by UserInputService. I don’t know how it works for Ctrl + R but that’s just my idea on why it doesn’t work.