UserInputService.InputBegan issue

Like this?

local Keybinds = {
[Enum.KeyCode.F] = block,
[Enum.KeyCode.One] = one,
[Enum.KeyCode.Two] = two,
[Enum.KeyCode.Three] = three,
[Enum.KeyCode.Four] = four,
[Enum.KeyCode.Five] = common,
[Enum.KeyCode.Six] = common,
[Enum.KeyCode.Seven] = common,
}
local Summons = {
[Enum.KeyCode.Five] = "One",
[Enum.KeyCode.Six] = "Two",
[Enum.KeyCode.Seven] = "Three",
}
UIS.InputBegan:Connect(function(input, GameProcessedEvent)
if GameProcessedEvent then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
lmb()
elseif Keybinds[input.KeyCode] then
Keybinds[input.KeyCode](Summons[input.KeyCode])
end
end)

I want common(“One”), common(“Two”) and common(“Three”) to all do different things, and it works like this. Can it be optimized though?

Yes that’s most likely the best way to do it

1 Like

Alright, thank you so much for your help!