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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 18 Jan 2014 08:01 PM |
Try:
Level = game.Players["Player"].leaderstats.Level.Value |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 18 Jan 2014 08:03 PM |
| oh, I didn't read that part. derp |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| Joined: 11 Apr 2008 |
| Total Posts: 6397 |
|
| |
|
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
|
  |
| 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 |
|
|
|
| 18 Jan 2014 08:12 PM |
| Why did it try to get Player directly from game? |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 18 Jan 2014 08:26 PM |
| I don't think LocalScript can be in StarterGui |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 13 Nov 2007 |
| Total Posts: 6315 |
|
|
| 18 Jan 2014 08:34 PM |
"game.player.LocalPlayer"
There's your problem. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|