|
| 16 Jun 2015 10:19 PM |
| How do I make a search bear where you don't have to type in the player's full name, just part of it, and it's able to find the player? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 16 Jun 2015 10:22 PM |
| string.gmatch("%*^#") something like that |
|
|
| Report Abuse |
|
|
morash
|
  |
| Joined: 22 May 2010 |
| Total Posts: 5834 |
|
|
| 16 Jun 2015 10:22 PM |
Bears can't read, so what your attempting to describe is impossible.
String concatenation. |
|
|
| Report Abuse |
|
|
morash
|
  |
| Joined: 22 May 2010 |
| Total Posts: 5834 |
|
| |
|
| |
|
|
| 16 Jun 2015 10:24 PM |
Here's your list:
http://wiki.roblox.com/index.php?title=Function_dump/String_manipulation#string.len |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Jun 2015 10:24 PM |
'%*^#' wtf what...
OP all players in-game? You can just use a loop and string.sub and the # operator. |
|
|
| Report Abuse |
|
|
|
| 16 Jun 2015 10:32 PM |
Hmm...
for i, v in pairs(workspace:GetChildren()) do for x in string.gmatch(v.Name, "Ba") do print(v, x) end end
How do I make it print if anything in the workspace starts with "Ba" |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Jun 2015 10:35 PM |
Do you want to start from the beginning of the string or from any part? Like: "cnt" gets cntkillme, will "kill" get cntkillme? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 16 Jun 2015 10:38 PM |
found this off of vote kick script. You could do something similar
function matchPlayer(str) local result = nil local players = game.Players:GetPlayers() for i = 1,#players do if (string.find(string.lower(players[i].Name), str) == 1) then if (result ~= nil) then return nil end result = players[i] end end return result end
function onChatted(msg, recipient, speaker) local source = string.lower(speaker.Name) msg = string.lower(msg) if (string.find(msg, "kick") == 1) then for word in msg:gmatch("%w+") do if word ~= "kick" then local p = matchPlayer(word) if p ~= nil then voteAgainst(source, p) end end end end end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Jun 2015 10:39 PM |
| That's such a bad kick script. |
|
|
| Report Abuse |
|
|
|
| 16 Jun 2015 10:43 PM |
Thanks!
for i, v in pairs (workspace:GetChildren()) do if (string.find(v.Name, "Ba") == 1) then print(v.Name) end end |
|
|
| Report Abuse |
|
|