Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Strange error? "bad argument #1 to 'pairs' (table expected, got number)"

elements = {
	ElemA = 1,
	ElemB = 2,
	ElemC = 3,
	Wood = 4,
	Metal = 5,
}
function elements:bynum(self, num)
	for i, v in pairs(self) do
		if num == v then return i end
	end
end

bad argument #1 to 'pairs' (table expected, got number) stack traceback:

1 answer

✓ Accepted answer

You do not need the "self" in the functions parameters

This discussion is preserved as it was. New answers, comments, and votes are closed.