generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Need help with this code.

Previous Thread :: Next Thread 
bluemantrolls101 is not online. bluemantrolls101
Joined: 31 Oct 2013
Total Posts: 322
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
bluemantrolls101 is not online. bluemantrolls101
Joined: 31 Oct 2013
Total Posts: 322
27 Oct 2015 04:02 PM
bump
Report Abuse
goro7 is not online. goro7
Joined: 01 Jul 2009
Total Posts: 735
27 Oct 2015 04:04 PM
What are the error messages?
Report Abuse
bluemantrolls101 is not online. bluemantrolls101
Joined: 31 Oct 2013
Total Posts: 322
27 Oct 2015 04:06 PM
attempt to index local 'kickedPlayer' (a nil value)
Report Abuse
expoundings is online. expoundings
Joined: 02 Feb 2013
Total Posts: 2359
27 Oct 2015 04:08 PM
local kickPlayer = msg:sub6, msg:len())
Report Abuse
expoundings is online. expoundings
Joined: 02 Feb 2013
Total Posts: 2359
27 Oct 2015 04:08 PM
whoops typed that wrong
local kickPlayer = msg:sub(6, msg:len())
Report Abuse
bluemantrolls101 is not online. bluemantrolls101
Joined: 31 Oct 2013
Total Posts: 322
27 Oct 2015 04:09 PM
Okay, That you a lot. :)
Report Abuse
expoundings is online. expoundings
Joined: 02 Feb 2013
Total Posts: 2359
27 Oct 2015 04:09 PM
np
Report Abuse
bluemantrolls101 is not online. bluemantrolls101
Joined: 31 Oct 2013
Total Posts: 322
27 Oct 2015 04:10 PM
Still get the same error as before
Report Abuse
expoundings is online. expoundings
Joined: 02 Feb 2013
Total Posts: 2359
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
bluemantrolls101 is not online. bluemantrolls101
Joined: 31 Oct 2013
Total Posts: 322
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
expoundings is online. expoundings
Joined: 02 Feb 2013
Total Posts: 2359
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image