Getting the key of an objekt in a dictionary with its index [solved]

Hello Forumers,
I stumbled upon a problem and I looked around for a bit, but no answers that help me
I want to get a Key from a value with its index
example:

local index = 1
dictionary = {
["lol"] = "?"
["lool"] = "??"
["something else"] = "..."
}
dictionary[1] <---- I want to know the key of this Value

thanks

you can’t index dictionaries with numbers

for _1 , rank in module.ranks do
		for _2 , playername in rank do
			if playername == Name then
				return module.ranks[_1]
			end
		end
	end

has no errors and works perfectly fine

That’s a string not a number

Correction: it is the whatever type the key is (it can be a table or Instance)

oh i didn’t notice that but thanks :partying_face:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.