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: string.sub help.

Previous Thread :: Next Thread 
EcIiptic is not online. EcIiptic
Joined: 12 Aug 2009
Total Posts: 13737
29 Dec 2013 04:42 PM
Okay does anyone know a tutorial on how to use string.sub in admin commands?

Or if someone can give me a brief example on how to use it?
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
29 Dec 2013 04:50 PM
There is some videos in this playlist on making admin commands.

I would recommend watching the non-admin command ones too but not necessary.

If you plan on making admin commands that are fairly long. You should learn pattern matching. It will make it a lot easier that just using subs.
youtube /watch?v=Urvn69ZbM_Y&list=PL8A3AFE78FAF8CF49
Report Abuse
jtfriend137 is not online. jtfriend137
Joined: 19 Jul 2010
Total Posts: 1960
29 Dec 2013 04:52 PM
http://wiki.roblox.com/index.php/Function_dump/String_manipulation#string.sub
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
29 Dec 2013 04:55 PM



print(string.sub("YELLO", 1,3)) --prints Characters 1 through 3 -->YEL

print(string.sub("YELLO", 2))--prints Characters 2 through the rest of the word -->ELLO


--Without finding patterns, this is a basic way to use string.sub()

game.Players.PlayerAdded:connect(function(p)
game.Players.PlayerAdded:connect(function(p)
p.Chatted:connect(function(msg)
if msg:lower():sub(1,5) == "kill/" then --Find the command
local plr = game.Players:findFirstChild(msg:sub(6)) --Find the players name starting at the 6th character.
if plr then
Instance.new("Hint", p.PlayerGui).Text = "Killing "..plr.Name
end
end
end)
end)
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
29 Dec 2013 04:56 PM
*

game.Players.PlayerAdded:connect(function(p)
p.Chatted:connect(function(msg)
if msg:lower():sub(1,5) == "kill/" then --Find the command
local plr = game.Players:findFirstChild(msg:sub(6)) --Find the players name starting at the 6th character.
if plr then
Instance.new("Hint", p.PlayerGui).Text = "Killing "..plr.Name
end
end
end)
end)
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