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: String.match help

Previous Thread :: Next Thread 
Djmann1013 is not online. Djmann1013
Joined: 17 Apr 2009
Total Posts: 1606
24 Jun 2015 05:56 PM
I am trying to find a part of a username, and if part of that username is found it will print my username.

But for some reason I have to put the full name in order for this to work. I want it so that all I have to put is "Dj" and it will find the full username.

Is there a way to do this?

Code:

local players = game.Players:GetPlayers()
for i=1, #players do
if string.match("Dj", players[i].Name) then
print("Found Djmann1013!")
end
end

Report Abuse
Locard is not online. Locard
Joined: 13 Apr 2014
Total Posts: 3516
24 Jun 2015 05:57 PM
So you want anyone with the first 2 letters named Dj to pass through?
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
24 Jun 2015 05:58 PM
for _,player in pairs(game.Players:GetPlayers()) do
if player.Name:find("Dj") then
print("Found Djmann1013!")
end
end
Report Abuse
Djmann1013 is not online. Djmann1013
Joined: 17 Apr 2009
Total Posts: 1606
24 Jun 2015 06:14 PM
Thanks clonetrooper it works!
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