Typocrite
|
  |
| Joined: 28 Aug 2013 |
| Total Posts: 6856 |
|
|
| 20 Jun 2014 01:42 PM |
using instance? Something is very wrong since not even "adding values" will print. There is no output.
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function() print("adding values") PLVL = Instance.new("IntValue", p.PlayerGui) PLVL.Value = 1 print("PLVL value added") end) end)
|
|
|
| Report Abuse |
|
|
|
| 20 Jun 2014 01:53 PM |
repeat wait() until Players.LocalPlayer a=Instance.new("NumberValue",Players.LocalPlayer) a.Name = "Name here" |
|
|
| Report Abuse |
|
|
jakej78b
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 813 |
|
|
| 20 Jun 2014 01:54 PM |
Why does everyone automatically assume the person is using a LocalScript when rarely that is the case.
Try to kill yourself and respawn and see if the value gets added, sometimes CharacterAdded doesn't fire on join. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2014 02:01 PM |
| <-- Sorry I'm used to making on enter scripts.. So I use local script alot.. |
|
|
| Report Abuse |
|
|
Typocrite
|
  |
| Joined: 28 Aug 2013 |
| Total Posts: 6856 |
|
|
| 20 Jun 2014 03:22 PM |
Here is what I got and it's still not working, even if I die. It is in a local script- should it not be?
game.Players.PlayerAdded:connect(function(p) wait(0.5) p.CharacterAdded:connect(function() print("adding values") PLVL = Instance.new("IntValue", game.Players.LocalPlayer) PLVL.Name = "PlayerLevelValue" PLVL.Value = 1 print("PLVL value added") end) end)
|
|
|
| Report Abuse |
|
|
|
| 20 Jun 2014 03:24 PM |
| try it in start server/player. Either that or in published play |
|
|
| Report Abuse |
|
|
Typocrite
|
  |
| Joined: 28 Aug 2013 |
| Total Posts: 6856 |
|
|
| 20 Jun 2014 03:26 PM |
| I tried it in a server and it didn't work.. any ideas? |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2014 03:28 PM |
put this in a normal script in serverscriptstorage
game.Players.PlayerAdded:connect(function(p) print("adding values") local STATS = Instance.new("Model", p) STATS.Name = "Stats" PLVL = Instance.new("IntValue", STATS) PLVL.Name = "PlayerLevelValue" PLVL.Value = 1 print("PLVL value added") end)
|
|
|
| Report Abuse |
|
|
Typocrite
|
  |
| Joined: 28 Aug 2013 |
| Total Posts: 6856 |
|
|
| 20 Jun 2014 03:35 PM |
It works! However, I want to store the value in the player's torso. How would I do that? Here is what I tried:
game.Players.PlayerAdded:connect(function(p) print("adding values") local STATS = Instance.new("Model", p.Character:findFirstChild("Torso")) STATS.Name = "Stats" PLVL = Instance.new("IntValue", STATS) PLVL.Name = "PlayerLevelValue" PLVL.Value = 1 print("PLVL value added") end)
"attempt to index field character (a nil value)" |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2014 03:51 PM |
| you forgot to add p.CharacterAdded:connect(function() to it. Then it should work for you. |
|
|
| Report Abuse |
|
|
iBrandyn
|
  |
| Joined: 30 May 2013 |
| Total Posts: 1699 |
|
|
| 20 Jun 2014 04:03 PM |
| Inserting a value into a player? Put it in Starter GUI! Every player will start with that value. |
|
|
| Report Abuse |
|
|