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 » Scripting Helpers
Home Search
 

Re: Strings

Previous Thread :: Next Thread 
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
18 Dec 2012 01:07 AM
if command:lower() == "kill" then
if game.Players:findFirstChild(argument) then
local x = game.Players:findFirstChild(argument)
if x.Character.Humanoid then
x.Character.Humanoid.Health = 0
end
end

How would I make it to where I can type the argument (player) in upper or lower case letters, and still have it work?
Also, how would I make it to where you don't have to type in the full name and still have the script function correctly.
Report Abuse
ObsessedwithMario is not online. ObsessedwithMario
Joined: 03 Mar 2012
Total Posts: 268
18 Dec 2012 01:33 AM
I think you would do something with upper(arguement) so if you typed "kill ob" it would look and see if the upper part of anyone's name starts with ob and then kill them. Still a rookie, trying to help but yeah. :P
Report Abuse
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
18 Dec 2012 07:27 AM
bump
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
18 Dec 2012 11:12 AM
You have to make your own FindFirstChild method. Also use string.match.
Report Abuse
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
18 Dec 2012 05:02 PM
What would I do to make it to where I can have the argument be typed in lower case and still function correctly?

string:lower(argument)
?
Report Abuse
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
18 Dec 2012 05:17 PM
bump
Report Abuse
Solotaire is not online. Solotaire
Joined: 30 Jul 2009
Total Posts: 30356
18 Dec 2012 05:24 PM
if string.lower(chattedMessage) == string.lower(yourcommand) then
Report Abuse
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
18 Dec 2012 05:29 PM
If that's the case, would this line work?

if command:lower() == "kill" then
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
18 Dec 2012 05:35 PM
game.Players.PlayerAdded:connect(function (p)
p.Chatted:connect(function (command)
if command:lower():sub(1,5) == "kill/" then
x = command:sub(6,#command)
playertokill = game.Players:findFirstChild(x)
playertokill.Character:BreakJoints()
end
end)
end)

--ends be off
Report Abuse
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
18 Dec 2012 05:38 PM
The ends don't really matter in this particular piece of the script, as this isn't the whole script.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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