Phidias
|
  |
| Joined: 06 Nov 2009 |
| Total Posts: 765 |
|
|
| 05 Feb 2015 12:12 AM |
| I'm having an issue with game.Players:FindFirstChild(player) returning nil when passed player from the ClickDetector.MouseClick event. What could be causing this? |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 05 Feb 2015 12:14 AM |
| The player argument of ClickDetector.MouseClick is already a player, so there's no need to do anything extra to get a player object. |
|
|
| Report Abuse |
|
|
pa00
|
  |
| Joined: 06 Jun 2010 |
| Total Posts: 451 |
|
|
| 05 Feb 2015 12:17 AM |
| I'm pretty sure that FindFirstChild only takes a string as an argument. If you're passing a player object to it, that's not the correct type and also redundant. |
|
|
| Report Abuse |
|
|
Phidias
|
  |
| Joined: 06 Nov 2009 |
| Total Posts: 765 |
|
|
| 05 Feb 2015 12:19 AM |
I'm needing to access the scoreboard value in the game.Players.playerName though
local p = game.Players:FindFirstChild(player) if p then p.leaderstats.Pocket.Value = p.leaderstats.Pocket.Value + 2
Also note im passing it over remoteEvent and handing the scoreboard stuffs in a server script |
|
|
| Report Abuse |
|
|
Phidias
|
  |
| Joined: 06 Nov 2009 |
| Total Posts: 765 |
|
|
| 05 Feb 2015 12:21 AM |
| Oh, well I also tried with player.Name and got nil so :( |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2015 12:21 AM |
I don't think you need to check if the player is there is it is already there?
If money grew on trees... It would be as valuable as leaves. | Twitter: @TwisterRBLX |
|
|
| Report Abuse |
|
|
pa00
|
  |
| Joined: 06 Jun 2010 |
| Total Posts: 451 |
|
|
| 05 Feb 2015 12:21 AM |
If you absolutely want to write the code like that, just replace player with player.Name in the FindFirstChild argument. But again, it's completely redundant. You could even say
p = player |
|
|
| Report Abuse |
|
|
parkiet3
|
  |
| Joined: 16 Jul 2011 |
| Total Posts: 832 |
|
|
| 05 Feb 2015 12:22 AM |
| Do player.Name if you really want to |
|
|
| Report Abuse |
|
|
Phidias
|
  |
| Joined: 06 Nov 2009 |
| Total Posts: 765 |
|
|
| 05 Feb 2015 12:25 AM |
| I feel like an idiot for not realising it was the same player as the players in game.Player and not the player from workspace |
|
|
| Report Abuse |
|
|
Phidias
|
  |
| Joined: 06 Nov 2009 |
| Total Posts: 765 |
|
| |
|