|
| 04 Nov 2012 11:03 AM |
I don't get why the string.match part gives me nil. . . Everything is defined.
for i, v in pairs(Game.Players:GetPlayers()) do print(v.Name:lower()) print(Target) print(string.match(v.Name:lower(), Target)) end
Output:
> player1 > player > nil --???
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 11:14 AM |
aide-moi, s'il vous plait
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 11:17 AM |
No idea why it wouldn't work, considering this works. print(string.match("player1", "player")) >player
|
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
| |
|
|
| 04 Nov 2012 11:23 AM |
Unless Target is a string, that won't work. If you're doing Mouse.Target, do this:
for i, v in pairs(Game.Players:GetPlayers()) do print(v.Name:lower()) print(Target) print(string.match(v.Name:lower(), Target.Name)) --Assuming this is declared: "local Target=Mouse.Target" end |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 11:33 AM |
@Gamer
Yup, I even confirmed it should've worked with that also.
@teh
Yes, it's a string of course.
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 04 Nov 2012 11:34 AM |
Post a list of what you are matching :)
string.match returns nil when there is no match. In an item in the list there must be no "player" in the string. |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 11:42 AM |
I know. I want to match a player's name, in this case, "player1", with whatever I put in the function (target), in this case "player".
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 11:43 AM |
Also, as I've done so by printing, neither of the two I want to match are nil, so I don't get why it doesn't match. They're both all lowercase, and have no spaces at the end.
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
PlusJon
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 1522 |
|
|
| 04 Nov 2012 11:49 AM |
Please add this to your script and tell me the output of this:
print(type(Target)) |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 11:55 AM |
string. I'm pretty sure I know what strings are. . . Why else would I be using string.match?
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
| |
|
|
| 04 Nov 2012 12:01 PM |
I don't see how it's necessary as we already established they're both strings that should be matched. Besides, my script is pretty messy, and could be hard to follow if you're not good with string manipulation.
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 12:13 PM |
ROBLOX.Forum["Roblox Game"]["Scripting Helpers"]["What the string.match"]:Bump()
¤¤ †KMXD† ¤¤
|
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 04 Nov 2012 12:16 PM |
| There's nothing wrong with this code. .-. |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 12:26 PM |
That's the most frustrating part, at least with a syntax error, I could fix it. I swear Roblox is just trolling me.
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 04 Nov 2012 02:20 PM |
| Yea it's not like there could be a problem with any other parts of the code. |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 05:37 PM |
Eh, I might as well give up on this thing.
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 06:25 PM |
for i, v in pairs(Game.Players:GetPlayers()) do print(v.Name:lower()) print(Target) print(string.match(v.Name:lower(), ("(%s)"):format(Target))) end
:) |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 09:50 PM |
No dice, still returns nil, Agent. :(
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 04 Nov 2012 09:57 PM |
| Yea guys, there's totally NO WAY that there could be a problem in the other part of the script, right? |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 09:59 PM |
Even if there was, the code could easily be converted to be stand-alone, and still not be working as expected. Plus, it printed the two strings I was trying to match, and those two are strings, that SHOULD not return nil.
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 04 Nov 2012 10:04 PM |
Well this works: Target = "player" wait(40) for i, v in pairs(Game.Players:GetPlayers()) do print(v.Name:lower()) print(Target) print(string.match(v.Name:lower(), Target)) end Soooo Yea. |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 10:05 PM |
Really? It's not like we haven't establish the code *should* be working or anything.
¤¤ †KMXD† ¤¤ |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 04 Nov 2012 10:06 PM |
ikr roblox must hate you :( |
|
|
| Report Abuse |
|
|