I’m trying to make it so that you press 2 buttons, but when I press CTRL, it opens the gui anyway.
Code -
local uip = game:GetService("UserInputService")
uip.InputBegan:Connect(function(input,gameProccesed)
if input.KeyCode == Enum.KeyCode.LeftControl and Enum.KeyCode.R then
script.Parent.Data.Fix.Visible = true
end
end)
I don’t believe you can use multiple keycodes for the input object. You should do what was suggested in a similar thread here and use IsKeyDown.
if (input.KeyCode == Enum.KeyCode.LeftControl and UIS:IsKeyDown(Enum.KeyCode.R)) or (input.KeyCode == Enum.KeyCode.R and UIS:IsKeyDown(Enum.KeyCode.LeftControl)) then
You can use multiple inputs, you just need to make sure you’re actually checking both inputs. The way he had it won’t work because he needs to check for the second input.
No, @Xx_FROSTBITExX was more on the right track.
Separate UserInputServiceEvents are fired for each key (and each state transition of the key.)
So for instance you could also keep your own CTRL-held flag that you set on InputBegan for the
control key, and then clear it on InputEnded (this is oversimplified, as you should have a timeout, etc.)