cade2000
|
  |
| Joined: 09 Aug 2009 |
| Total Posts: 887 |
|
|
| 25 Jul 2014 07:01 PM |
I can't figure out whats wrong with this!!!
-_-
function chat(msg,p) if string.sub(msg,1,2) == "k " then if game.Players[string.sub(msg,3,-1)].Character.Head ~= nil then game.Players[string.sub(msg,3,-1)].Character.Head:Destroy() end end
if string.sub(msg,1,2) == "b " then if game.Players[string.sub(msg,3,-1)] ~= nil then game.Players[string.sub(msg,3,-1)]:Destroy() end end end
game.Players.cade2000.Chatted:connect(chat)
It's so simple, what's wrong with it? |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2014 07:05 PM |
When the game first starts up (aka when the script runs) game.Players.cade2000 = nil
MomoiroCloverZ, newbag expert Lua coder. |
|
|
| Report Abuse |
|
|
cade2000
|
  |
| Joined: 09 Aug 2009 |
| Total Posts: 887 |
|
|
| 25 Jul 2014 07:05 PM |
Seriously, whats wrong with this?? It seems to be completely fine.. |
|
|
| Report Abuse |
|
|
cade2000
|
  |
| Joined: 09 Aug 2009 |
| Total Posts: 887 |
|
|
| 25 Jul 2014 07:05 PM |
| No I'm running the script in a script builder to test it, that couldn't be the case. |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2014 07:06 PM |
What problems are you having?
(Btw, it's case sensitive so K or B won't work while k or b might) |
|
|
| Report Abuse |
|
|
cade2000
|
  |
| Joined: 09 Aug 2009 |
| Total Posts: 887 |
|
|
| 25 Jul 2014 07:08 PM |
Nothing is happening, the script builder I'm using has no output as well...
can't test in studio because you have to chat. |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2014 07:09 PM |
function chat(msg,p) if string.sub(msg,1,2):lower() == "k " then if game.Players[string.sub(msg,3)] and game.Players[msg:sub(3)].Character and game.Players[msg:sub(3)].Characters.Head ~= nil then game.Players[string.sub(msg,3)].Character.Head:Destroy() end end
if string.sub(msg,1,2):lower() == "b " then if game.Players[string.sub(msg,3)] ~= nil then game.Players[string.sub(msg,3)]:Destroy() end end end
game.Players.cade2000.Chatted:connect(chat)
MomoiroCloverZ, newbag expert Lua coder. |
|
|
| Report Abuse |
|
|
cade2000
|
  |
| Joined: 09 Aug 2009 |
| Total Posts: 887 |
|
|
| 25 Jul 2014 07:11 PM |
| Didn't work, maybe the script builder is blocking the script somehow.. |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2014 07:14 PM |
Try removing the "p" parameter so that it's just "(msg)". Just a hunch. |
|
|
| Report Abuse |
|
|
| |
|