"Double" indexing doesnt work?

For some reason when you index a table like this,

local keybind = keybinds.current[tool.Name[script.Name]]

print(keybind) -- Prints nil

It will not work, BUT if you write it like this instead, it will work.

local keybind = keybinds.current[tool.Name][script.Name]

print(keybind) -- Prints Enum.UserInputType.MouseButton1

In theory, these two do the exact same thing, so why is this an issue?

[tool.Name[script.Name]]] is nil because they’re both strings and you can only index into a table

2 Likes

Oh okay, so when I do it like that it is basically trying to index that there is a value inside of tool.Name which is a string so it won’t work

1 Like

Yeah basically