The answer @gullet has sent is absolutely right and will suffice your problem. I'm just going to explain to you why your script didn't work in the first place.
The problem isn't using semicolons over commas, it's your table's content itself. Let's first discuss some essentials
Dictionaries
A lot of people take use different analogies to explain the concept of dictionaries, but I'll use a very straightforward analogy. Imagine a dictionary in Lua as an actual dictionary. You have lots of words each with their own meaning, the words can be verbs, adjectives, anything and their meanings can be of any form as well. To get the meaning of a word, you look up the word in the dictionary and find it's meaning next to it.
The implementation of this in Lua is as such:
local myDictionary = {
Word = "Meaning",
OtherWord = "OtherMeaning"
}
print(myDictionary.Word)
print(myDictionary.OtherWord)
myDictionary.NewWord = "NewMeaning"
print(myDictionary.NewWord)
So we observe that:
1• Dictionaries always include pairs of values
Some technical points:
1• In the example, each word is an index — and index is what you look up and each meaning is a value
2• Indices (indexes) can be of any DataType, number, bool, string and even instances!
Conventions and stuff:
1• If more than one pair of entries are present in a dictionary, break your dictionary into several lines for readability
2• Often dictionary indices are enclosed by rectangular rackets. This is necessary in certain cases such as numerical indices
Tables as dictionaries
Tables can be thought of as dictionaries with numerical indices, i.e.:
local myTable = {"Value1", "Value2"}
print(myTable[1])
local myDictionary = {
[1] = "Value1",
[2] = "Value2"
}
print(myDictionary[1])
Now that we know what's what, we can see that Banned[plr.Name] looks up for a value in Banned that is paired with plr.Name as it's index, but our banned table by default has numerical indices! Meaning our value is supposed to be an index!
That's it!
After that, @gullet's answer is what you need read.
2 comments
use a comma not a semicolon probably...
That won't be enough in this case. That would make it a valid Lua array, but the player names would be the values for indices 1 and 2, not keys as he's expecting. Gullet's solution is how it should be done.