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: String expected, got user data/.

Previous Thread :: Next Thread 
dom2d2 is not online. dom2d2
Joined: 11 Apr 2008
Total Posts: 6397
18 Jan 2014 07:57 PM
Help, this isn't working.


Level = game.Players[Player].leaderstats.Level.Value


What's wrong with this?
Report Abuse
suremark is not online. suremark
Joined: 13 Nov 2007
Total Posts: 6315
18 Jan 2014 07:59 PM
Try

game.Players["Player"]

instead of

game.Players[Player].
Report Abuse
dom2d2 is not online. dom2d2
Joined: 11 Apr 2008
Total Posts: 6397
18 Jan 2014 08:00 PM
Sorry, "Player is a predefined variable.

player = script.Parent.Parent
Report Abuse
thetacah is not online. thetacah
Joined: 18 Jan 2013
Total Posts: 16026
18 Jan 2014 08:01 PM
Try:


Level = game.Players["Player"].leaderstats.Level.Value
Report Abuse
suremark is not online. suremark
Joined: 13 Nov 2007
Total Posts: 6315
18 Jan 2014 08:02 PM
You don't need to index game.Players, then-- Player is already the object you want.

Player.leaderstats.Level.Value
Report Abuse
dom2d2 is not online. dom2d2
Joined: 11 Apr 2008
Total Posts: 6397
18 Jan 2014 08:02 PM
:|

Player IS A VARIABLE, so It cannot be put into quotation marks.
Report Abuse
thetacah is not online. thetacah
Joined: 18 Jan 2013
Total Posts: 16026
18 Jan 2014 08:03 PM
oh, I didn't read that part. derp
Report Abuse
dom2d2 is not online. dom2d2
Joined: 11 Apr 2008
Total Posts: 6397
18 Jan 2014 08:04 PM
@Suremark, when I do that, I get this:
attempt to index global 'Player' (a nil value)
Report Abuse
suremark is not online. suremark
Joined: 13 Nov 2007
Total Posts: 6315
18 Jan 2014 08:06 PM
Then something's wrong with your variable declaration. Where did you put the script inside of? Also, if it's a LocalScript then you can just use game.Players.LocalPlayer.
Report Abuse
dom2d2 is not online. dom2d2
Joined: 11 Apr 2008
Total Posts: 6397
18 Jan 2014 08:06 PM
Dur, it's local.
Thanks.
Report Abuse
thetacah is not online. thetacah
Joined: 18 Jan 2013
Total Posts: 16026
18 Jan 2014 08:07 PM
local player = game.Players.LocalPlayer


player.leaderstats.Level.Value = player.leaderstats.Level.Value -1




This works, if it's in a localscript.
Report Abuse
dom2d2 is not online. dom2d2
Joined: 11 Apr 2008
Total Posts: 6397
18 Jan 2014 08:10 PM
20:10:24.921 - player is not a valid member of DataModel
Report Abuse
alexthemongolian is not online. alexthemongolian
Joined: 23 Mar 2011
Total Posts: 655
18 Jan 2014 08:12 PM
Why did it try to get Player directly from game?
Report Abuse
suremark is not online. suremark
Joined: 13 Nov 2007
Total Posts: 6315
18 Jan 2014 08:14 PM
There's nothing wrong with the code he posted, there's likely something wrong in the rest of your script.

Did you try to do game[player] at any point? You should post the entire source.
Report Abuse
thetacah is not online. thetacah
Joined: 18 Jan 2013
Total Posts: 16026
18 Jan 2014 08:15 PM
Yeah, sure is right; you should post the whole script.
Report Abuse
dom2d2 is not online. dom2d2
Joined: 11 Apr 2008
Total Posts: 6397
18 Jan 2014 08:24 PM
This script is a localscript placed in starterGUI.



wait(2)
local player = game.Players.LocalPlayer
Level = player.leaderstats.Level.Value

if Level == 0 then
wait(2)
player.Character.Humanoid.WalkSpeed = 30
game.player.LocalPlayer.Character:MoveTo((game.Workspace.One.Position))
end
Report Abuse
alexthemongolian is not online. alexthemongolian
Joined: 23 Mar 2011
Total Posts: 655
18 Jan 2014 08:26 PM
I don't think LocalScript can be in StarterGui
Report Abuse
thetacah is not online. thetacah
Joined: 18 Jan 2013
Total Posts: 16026
18 Jan 2014 08:30 PM

wait(2)
local player = game.Players.LocalPlayer
Level = player.leaderstats.Level.Value

if Level == 0 then
wait(2)
player.Character.Humanoid.WalkSpeed = 30
game.player.LocalPlayer.Character:MoveTo(game.Workspace.One.Position)
end

Report Abuse
suremark is not online. suremark
Joined: 13 Nov 2007
Total Posts: 6315
18 Jan 2014 08:34 PM
"game.player.LocalPlayer"

There's your problem.
Report Abuse
thetacah is not online. thetacah
Joined: 18 Jan 2013
Total Posts: 16026
18 Jan 2014 08:35 PM
@SURE, HOW DID I MISS THAT?

game.Players.LocalPlayer
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
18 Jan 2014 08:36 PM
lol surprising to see this from a wiki writer
Report Abuse
suremark is not online. suremark
Joined: 13 Nov 2007
Total Posts: 6315
18 Jan 2014 08:38 PM
Yeah, I will admit I'm a little disappointed. :\ But hopefully this was just a dumb mistake.
Report Abuse
dom2d2 is not online. dom2d2
Joined: 11 Apr 2008
Total Posts: 6397
18 Jan 2014 08:40 PM
Lol, I'm a new scripter, I was made a wiki writer for things other than scripting.
:P
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
18 Jan 2014 08:41 PM
what, are you going to make the wiki pretty?
Report Abuse
dom2d2 is not online. dom2d2
Joined: 11 Apr 2008
Total Posts: 6397
18 Jan 2014 08:42 PM
Thaeh,

I make videos, also, there are lots of building/website tutorials and site documentation and features to write about.
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