|
| 19 Dec 2013 03:08 PM |
I got a script that gives game pass holders extra stats when they join a game, and its not working for some reason. This is what the output says:
15:06:41.824 - Workspace.Gamepass Money:21: attempt to index global 'PlayersService' (a nil value) 15:06:41.825 - Script 'Workspace.Gamepass Money', Line 21 15:06:41.825 - stack end 23 Money Leaderboard Loaded
Any ideas what wrong? Heres the script if that helps:
GamePassID = 100531685 CreditType = Kills Amount = 1337
game.Players.PlayerAdded:connect(function(player) if game:GetService("GamePassService"):PlayerHasPass(player.userId, GamePassID) then player:findFirstChild("Leaderstats").CreditType.Value = Amount else end end)
PlayersService.PlayerAdded:connect(OnPlayerAdded)
Thanks,
Luke |
|
|
| Report Abuse |
|
|
ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
|
| 19 Dec 2013 03:11 PM |
PlayersService should be PlayerService
check grammar, the output is very helpful and this should have been something you could figure out. |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 03:12 PM |
| XD thanks, hopefully that's the problem |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 03:15 PM |
| That didn't do it, the output still says PlayerService is a nil value :/ |
|
|
| Report Abuse |
|
|
ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
|
| 19 Dec 2013 03:18 PM |
well yeah because your using it wrong
tons of problems with your script and I don't feel like fixing them
Change PlayerService to Game.Players unless you want to insert the playerservice |
|
|
| Report Abuse |
|
|
Quorum
|
  |
| Joined: 25 Oct 2013 |
| Total Posts: 4680 |
|
|
| 19 Dec 2013 03:24 PM |
@OP, GamePassID = 100531685 Amount = 1337
game.Players.PlayerAdded:connect(function(player) if game:GetService("GamePassService"):PlayerHasPass(player, GamePassID) then player:findFirstChild("Leaderstats").Kills.Value = Amount end end)
1) That connection line you threw on wasn't needed - wasn't doing anything 2) The PlayerHasPass takes a player and a "GamePassID" not an integer and a "GamePassID".
@Cold, There weren't that many errors. |
|
|
| Report Abuse |
|
|
ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
|
| 19 Dec 2013 03:26 PM |
yeah I realized that I forgot which thread I was looking at
there was another thread I just clicked on that had a lot of errors |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 03:37 PM |
| Its still not working, but the output isn't saying anything is wrong with it |
|
|
| Report Abuse |
|
|
Quorum
|
  |
| Joined: 25 Oct 2013 |
| Total Posts: 4680 |
|
|
| 19 Dec 2013 03:40 PM |
| Insanely, how are you testing it? If it's not online, that'll be the issue. |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 03:41 PM |
| I put exactly what you said directly into a script, and just put it into an empty game with the script and the leaderboard |
|
|
| Report Abuse |
|
|
Quorum
|
  |
| Joined: 25 Oct 2013 |
| Total Posts: 4680 |
|
|
| 19 Dec 2013 03:45 PM |
@Insanely, Online, in a game, or...? |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 03:47 PM |
| I went into edit on studio, and created a new script in workspace in one of my games. I suppose that makes it online. |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 03:58 PM |
| Could it have something to do with the leaderboard? |
|
|
| Report Abuse |
|
|