|
| 22 May 2014 02:29 PM |
| I'm making an xp system where the value is in the character. How do I insert a value in him, cloning it each death? |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 02:31 PM |
| Starterpack would do that, but you should probably just put it in the player instead of the character. |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 02:34 PM |
Perhaps something like this:
wait() if ((character).XP == nil) then local value = Instance.new("NumberValue") value.Parent = -- Somehow make this the character. value.name = ("XP") script.Parent.Humanoid.Died:connect(function() wait(10) newvalue = value:clone() newvalue.Parent = -- Again, somehow make this the character. newvalue.Name = ("XP") newvalue.Value = value.Value end) end |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 02:35 PM |
| Good idea. How do I add a value into each player? |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 02:37 PM |
| I'd say use player added and add it in when they join. |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 02:40 PM |
wait() local player = --onPlayerEntered? value = Instance.new("NumberValue") value.Parent = player.StarterPack value.Name = ("XP") end |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 02:45 PM |
It is a function. Here is the wiki page:
http://wiki.roblox.com/index.php/PlayerAdded_(Event) |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 02:45 PM |
Maybe this?
wait() local player = game.Players.PlayerAdded print("Adding the XP value!") value = Instance.new("NumberValue") value.Parent = player.StarterGear value.Name = ("XP") |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 02:52 PM |
Then, why doesn't this work?
wait() game.Players.PlayerAdded:connect(function(player) print("Adding the XP value!") value = Instance.new("NumberValue") value.Parent = player.StarterGear value.Name = ("XP") end) |
|
|
| Report Abuse |
|
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 22 May 2014 02:56 PM |
| Why would you put it in StarterGear? But yeah that should work. |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 02:59 PM |
| I put it in a local script, and it still didn't work. Do I have to put it in players? |
|
|
| Report Abuse |
|
|
|
| 22 May 2014 03:01 PM |
game.Players.PlayerAdded:connect(function(player) --PlayerAdded event, player argument
--stuff
end |
|
|
| Report Abuse |
|
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 22 May 2014 03:05 PM |
| Any output? Is anything printing? |
|
|
| Report Abuse |
|
|