|
| 12 Oct 2017 01:13 PM |
So, for example, assuming that the variable 'p' is already defined as local player, how would you get parts of a message, like in those Admin scripts;
key == ";" p.Chatted:Connect(function(msg) if msg == key.."Kill " end)
how would I make it receive the last word to find the player to kill? |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2017 01:28 PM |
You can get that part by doing something like
local name = msg:sub(6)
That sets the value of 'name' to a copy of the string, but starting from the 6th character instead. |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2017 01:54 PM |
| Ok, I have 1 more question. If I wanted to add a "shortcut", you could say, so that it can get the player's character, such as ";kill Gen", how would I get the string for the name? Would I need a continued loop? |
|
|
| Report Abuse |
|
|
LaeMVP
|
  |
| Joined: 24 Jun 2013 |
| Total Posts: 4416 |
|
|
| 12 Oct 2017 01:54 PM |
local args = {} local insert = table.insert for i in msg:gmatch("%S+") do insert(args,i:lower()) end |
|
|
| Report Abuse |
|
|