|
| 27 Oct 2015 03:56 PM |
Okay so I am making a kick script, but I am getting an error with line 3 and 4. Please help if msg:sub(1,5):lower() == "'kick" and Player.IsAdmin.Value == true then local kickPlayer = msg:sub(6) local kickedPlayer = game.Players:FindFirstChild(kickPlayer) kickedPlayer:Kick("You have been kicked") end
Every works but thous two lines. |
|
|
| Report Abuse |
|
|
| |
|
goro7
|
  |
| Joined: 01 Jul 2009 |
| Total Posts: 735 |
|
|
| 27 Oct 2015 04:04 PM |
| What are the error messages? |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2015 04:06 PM |
| attempt to index local 'kickedPlayer' (a nil value) |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2015 04:08 PM |
| local kickPlayer = msg:sub6, msg:len()) |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2015 04:08 PM |
whoops typed that wrong local kickPlayer = msg:sub(6, msg:len()) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 27 Oct 2015 04:10 PM |
| Still get the same error as before |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2015 04:12 PM |
try this;
if kickedPlayer then kickedPlayer:kick("You have been kicked") end
if that doesn't work, try changing the 6 to a 7 |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2015 04:13 PM |
| Ah that was my problem. Thanks for the refresh. I forgot about the space between kick and the players name :/. Thanks for your help. |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2015 04:16 PM |
np also you should keep the 'if kickedPlayer then' and then kick the player just to make sure kickedPlayer is actually in the game |
|
|
| Report Abuse |
|
|