I'm trying to make a command where it will whitelist and add the player of the name I typed in into the table of whitelists. However, it's not adding them.
local settings = { whitelist = {"PLAYER1", "PLAYER2"}, prefix = ";" }
local prefix = settings.prefix
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
this part of the code shows the settings which has the whitelist table and i want to extend it when i do the whitelist command but it doesn't work.
elseif cht:match(prefix .. "whitelist") then
local target = plrs[cht:sub(12)]
table.insert(settings.whitelist, target)
heres the part where i Try to table insert the targets name into the whitelist table. Any way to fix this? (I only showed the parts of the scripts that are affecting the names being added, everything else works proper so the target and etc is already made)
Basically, what do I put in the table.insert for me to add the targets name into the whitelist?

2 comments
Not quite sure how I would use this, my code is like elseif cht:match(prefix .. "whitelist") then (it would table insert their name but it just doesn't work) I don't know how I'd put this into my script with it also working with my ";" prefix. and yes its a localscript
Then use a script inserted in ServerScriptStorage, because you can't get chatted Event on local script.