So I was making my own admin commands and I just figured out a new problem was that what if a command needed more information to execute it?
e.g: If a player executes a music command, the scripts are gonna need to know what the SoundId is and where to play it and even when to stop all inside a player's chat message. Some commands need different amounts of information to fully execute the command.
Take a kick command for example. It needs two pieces of information, the player to kick and what to say in the "you got kicked" message, while the music command above needs three pieces of information.
The problem is how do I know when certain commands needs more information? My code splices the chat message sent by a player by spacing using a string pattern.
What my system basically does:
- If it compares a string command with part of the player's chat message
- Grabs the index of that string command that is inside of a table
- Executes the index inside a table full of running the actual commands
I have functions that execute based on commands like as shown:
local RunFunctions = {
function(Player, KickMessage) -- kick function
end,
function(SoundId, StopTime, Part) -- sound command, index: 2
end
}
local Commands = {
"/kick"
"/playsound" -- index: 2
}
for i,v in pairs(Commands)
if FirstWordOfChatMessage == v then
RunFunctions[i]()
return
end
end
My system looks like its challenging to add in those extra bits of information. I don't know what an actual admin command pack actually works by but I'm creating this without prior knowledge to challenge myself. I just need some help on the way. Sorry if this is all too confusing I'm not sure how to explain it properly.

1 comment
Your system is good and I now use it but what if I want to include "player objections" like "/kick me" or "/kick others". How should I make sure that a command doesn't require one of those player objections?