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 » Scripting Helpers
Home Search
 

Re: GUI Stats Script

Previous Thread :: Next Thread 
InsanelyLuke is not online. InsanelyLuke
Joined: 21 May 2010
Total Posts: 146
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 is not online. 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
InsanelyLuke is not online. InsanelyLuke
Joined: 21 May 2010
Total Posts: 146
19 Dec 2013 03:12 PM
XD thanks, hopefully that's the problem
Report Abuse
InsanelyLuke is not online. InsanelyLuke
Joined: 21 May 2010
Total Posts: 146
19 Dec 2013 03:15 PM
That didn't do it, the output still says PlayerService is a nil value :/
Report Abuse
ColdSmoke is not online. 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 is not online. 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 is not online. 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
InsanelyLuke is not online. InsanelyLuke
Joined: 21 May 2010
Total Posts: 146
19 Dec 2013 03:37 PM
Its still not working, but the output isn't saying anything is wrong with it
Report Abuse
Quorum is not online. 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
InsanelyLuke is not online. InsanelyLuke
Joined: 21 May 2010
Total Posts: 146
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 is not online. Quorum
Joined: 25 Oct 2013
Total Posts: 4680
19 Dec 2013 03:45 PM
@Insanely,
Online, in a game, or...?
Report Abuse
InsanelyLuke is not online. InsanelyLuke
Joined: 21 May 2010
Total Posts: 146
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
InsanelyLuke is not online. InsanelyLuke
Joined: 21 May 2010
Total Posts: 146
19 Dec 2013 03:58 PM
Could it have something to do with the leaderboard?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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