So I’m trying to make a system where if you have your gun out and press control + click it’ll fire a different kind of bullet but i don’t know how i’d make it detect the control+click i’ve looked around and found this
local UIS = game:GetService("UserInputService")
local function keyCombo(key, GPE)
local keysPressed = UIS:GetKeysPressed()
local control, click = false, false
for _, key in ipairs(keysPressed) do
if (key.KeyCode == Enum.KeyCode.LeftControl) then
space = true
elseif (key.KeyCode == Enum.KeyCode.idkwhatgoeshere) then
shift = true
end
end
if control and click then
-- fire gun
end
end
UIS.InputBegan:Connect(keyCombo)
but since there’s no keycode for the left mouse button i’m not sure how i would do this
Idk if this is efficient but this is how id do it:
local uis = game:GetService("UserInputService")
local controlDown = false
uis.InputBegan:Connect(function(input, isProcessed)
if not isProcessed then
if input.KeyCode == Enum.KeyCode.LeftControl then
controlDown = true
elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
if controlDown then
print("Left control and mouse button 1 clicked")
end
end
end
end)
uis.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl then
controlDown = false
end
end)