Since I'm still a bit new to scripting, I don't know where these Values are being put when created.
function NewPlayer(Player) local Stats = Instance.new("IntValue",Player) Stats.Name = "leaderstats" local Laps = Instance.new("IntValue", Stats) Laps.Value = 0 Laps.Name = "Laps"
The second argument of Instance.new
(i.e, the second thing in the parentheses) will become the Parent of the object created. On line 2, an IntValue is getting created and put into the Player
parameter of the function. What the parameter equals depends on what you're doing with the function, but that's where the IntValue will go.
Then, on line 5, another IntValue is created and put into Stats
, which is the IntValue you created on line 2.
good question, I didn't understand how this worked for awhile. That code uses "Instance.new()" to insert an int value into a game. This is the setup: Instance.new(item being created , its parent)
In your case, it looks like the int value is being placed inside of player. I assume the like that connects to the function looks like: game.Players.PlayerAdded:connect(PlayerAdded)
"Player" in this case is player who just joined, the part of them that is found in game.Players.(player's name)
since the intvalue is placed inside the player there, it will look like: game.Players.(Player's name).leaderstats ---the next line changes its name to "leaderstats"
The next intvalue is placed inside stats which is the intvalue created right above.
To find these int values, you will have to start a test server with at least 1 player in studio mode and look in game.Players.Player1