Alright so It appears I am having a bit of an error… This is where I am at in my code
local mytab={}
local combomoves={
[122]=true;
[122]=function(number)
if number==1 then
print("Hi")
elseif number==2 then
print("Hey")
elseif number==3 then
print("Finished")
end
end;
[122]=true;
[122]=true;
[122]=true;
}
local timer = time()
UIS.InputBegan:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.Keyboard and not gpe then
local keyPressed = input.KeyCode
if combomoves[122] then
if time() - timer < .5 and time() - timer > .2 then
if #mytab < 3 then
timer = time()
table.insert(mytab,input.KeyCode)
local combo = #mytab
combomoves[122](combo)
end
end
end
end
end)```
ignore the multiple [122]=true;
I can’t find out why the key isn’t being printed I think its the way I’m handling the keycode but I’m not quite sure. No errors are coming out because It’s not registering the key being pressed
So the issue lies in your table. After you declare the function to value 122 in your table, you proceed to reassign that index to true three times, effectively overwriting the function.
oof alright thanks. But I also kind of came to a more simple solution with a small amount of experimenting. The only thing it lacks is a timer which I will add.
local UIS = game:GetService("UserInputService");
local newtab = {};
UIS.InputBegan:Connect(function(inp,gpe)
if inp.UserInputType == Enum.UserInputType.Keyboard or inp.UserInputType == Enum.UserInputType.MouseButton1 and not gpe then
print(inp.KeyCode, inp.UserInputType)
if #newtab < 3 then
if inp.UserInputType == Enum.UserInputType.Keyboard then
table.insert(newtab,inp.KeyCode)
elseif inp.UserInputType == Enum.UserInputType.MouseButton1 then
table.insert(newtab, inp.UserInputType)
end
if newtab[1] == Enum.UserInputType.MouseButton1 and newtab[2] == Enum.UserInputType.MouseButton1 and newtab[3] == Enum.UserInputType.MouseButton1 then
print'SwordCombo'
end
else
table.remove(newtab,1)
table.remove(newtab,2)
table.remove(newtab,3)
end
print(newtab[1],newtab[2],newtab[3])
end
end)