So I'm making my own admin commands and I want it to be fully customizable by other players. They can add their own commands, remove them or edit them.
The commands execute on a string by which the player chatted with the .Chatted event like most admin commands do anyway.
My plan was thinking of was when the player chats something the script searches through the "table of commands" and see if its right and has a function attached to it.
I'm not sure on if you can have a function attached to a string in a table like this:
local commands = {
"kick" = function CommandsKickPlayer(player)
player:Kick()
end
}
LocalPlayer.Chatted:Connect(function(text)
for i,v in pairs(commands) do
if v == text then
v() -- call the corresponding function
end
end
end)
I don't think you could do it but if there's another way on how to make easy customizable commands then please tell me.

5 comments
maybe loadstring can somehow be a use to this, ill see if I could look into this some more later
Isn't loadstring really dangerous or something? I'm not sure what it does but people tell me exploiters can come in your game and copy it. Is there anyway to make commands that are string based?
can't u just remove the quotation marks and just try it?
Are you trying to take in command functions through chat or just want commands to be used through chat?
I want commands to be used through chat and removing the quotation marks will not do anything because if an admin said "kill" in string format the command is going to be kill in code format and they are not the same. Only if you could convert strings to code that would be a possibility