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: Leaderstats is not a valid member of PlayerGui?

Previous Thread :: Next Thread 
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
12 Aug 2013 01:12 PM
Before you ask, yes, this is in a LocalScript.
Here's the line of code where the error lies:

if game.Players.LocalPlayer.leaderstats.Lvl.Value <= 5 then

And the output:
20:06:48.362 - leaderstats is not a valid member of PlayerGui
20:06:48.364 - Script "Players.Player1.PlayerGui.ObjectiveGUI.Objectives.LocalScript", Line 5
20:06:48.364 - stack end

Tested using Test-> Start Server-> Start Player and also by saving the game and clicking "Play" as normal...

What am I doing wrong? Any help is appreciated.
Thanks.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
12 Aug 2013 01:20 PM
game.Players.LocalPlayer shouldn't be of type PlayerGui....

I'm calling shenanigans
Report Abuse
luke111000 is not online. luke111000
Joined: 26 Apr 2009
Total Posts: 1853
12 Aug 2013 01:24 PM
I think your ROBLOX may be broken...
Never will game.Players.LocalPlayer become a member/type of PlayerGui

Possibru.
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
12 Aug 2013 01:27 PM
Well that's why I'd need some help, I don't understand this either ._.
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
12 Aug 2013 01:29 PM
I also tried using a normal script and doing script.Parent.Parent.Parent.Parent instead.
Same result.

God this is confusing ._.
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
12 Aug 2013 02:01 PM
I made a model of the whole GUI that this script is in. If you fix it or if it works for you you can have it. (free st00f ermahgerd)

If anyone could try the model out and see if you get the same error that would be helpful:
http://www.roblox.com/ObjectiveGUI-item?id=126222800

You will also need a leaderboard for the whole script to work, but to just see this error you shouldn't need it...
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
12 Aug 2013 02:10 PM
That's not line 5, the one that you think is line 5.

That's line 3.
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
12 Aug 2013 02:13 PM
I altered the script a tiny bit before making it into a model. Didn't change the output on my part though :/
(Except for the Line part)
Sorry for any confusion.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
12 Aug 2013 02:25 PM
Because you are doing it wrong

game.Players.LocalPlayer.leaderstats, not script.Parent.Parent.leaderstats or whatever you have
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
12 Aug 2013 02:39 PM
game.Players.LocalPlayer.leaderstats is exactly what I have right now...
I tried script.Parent.Parent.Parent.leaderstats also, but that gave exactly the same error. :S
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
12 Aug 2013 02:58 PM
Has anyone tried the model...?
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
12 Aug 2013 03:07 PM
Blocco is correct. You gave us the incorrect line.

"sp = script.Parent.Parent" -> ObjectiveGUI
"sp.Objective.Settings.CurrentAmount.Value = sp.Parent.leaderstats.Lvl.Value"

You're attempting to find 'leaderstats' in the player's PlayerGui, hence your error. This was pointed out by Blocco.

Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
12 Aug 2013 03:14 PM
My bad, I got line 3 confused with line 5 since what is now line 3 used to be line 5...
(should have seen it since it's obvious with the output...)

Anyway, thanks for the help and sticking around helping me even though it was just me being confused after all!
Appreciate it :)
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