Well, I'm trying to create a script to enter a table, but when checking if the player is on the table so as not to insert it again, it doesn't just check it, can someone help me?
My script is in module:
local module = {} module.Players = {} module.Click = function(Nick) if not module.Players[Nick] then table.insert(module.Players,#module.Players + 1,Nick) end end return module
It's simple,
if not module.Players[Nick] then module.Players[Nick] = true end
Make the value equal true instead of inserting it though you can insert it AND make it true, Please make sure you check the wiki before you answer 80% sure this is a troll.
The issue is you're trying to use a list as a dictionary. Lists values are obtained by an index (a number), and dictionaries via Strings.
So maybe, the best solution is either iterating through the table with a for loop, or turning the list into a dictionary by just adding values with a name, like this:
local module = {} module.Players = {} module.Click = function(Nick) if not module.Players[Nick.Name] then module.Players[Nick.Name] = Nick --module.Players would look like this: {Nick = Nick} --To get the player, you should write module.Players[Nick.Name] end end return module