I'm not sure if this is possible but I really want to know.
Can you get args from onChatted?
For example, is there any way to make a command like !promote InsertAPI 1-255?
Could you please supply some links to get me started please if it's possible? :)
Thanks! Nathan.
PS: I have some starting code here, it's just that I don't know how to finish it off.
game.Players.PlayerAdded:connect(function(Player) Player.Chatted:connect(function(msg) if Player:GetRankInGroup(1240173) >= 12 then if msg == "!promote" then print("wut") end end end) end)
Here is the link for string manipulation. Use string.sub and string.find to find what certain parts of the string are. For example, you could use string.sub to find what's after the 6th character in the command "!kill " to see who to kill. You could use string.find to find certain text in the string. Like if you wanted to compare a name prefix to an actual player name (doing "!kill boba" instead of "!kill bobafett3544") by doing something like this (may not work, this is just an idea):
for i, player in pairs(game.Players:GetPlayers()) do if string.find(player.Name, message) ~= nil then print(player.Name) end end
And even though the above example may not work, I have to type the following because it might work better.
for i, player in pairs(game.Players:GetPlayers()) do if string.match(player.Name, message.."%w+") == player.Name then print(player.Name) end end
Ok. I've given you two examples. I'm going to create a function to find a player's name based on a prefix, and once I create that function, I will include it in this answer.
Note: There's no function to promote a player in their group if you are in-game. Just thought I'd let you know.