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
 

How to insert a value into player?

Previous Thread :: Next Thread 
Typocrite is not online. 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
Meowcatmaster is not online. Meowcatmaster
Joined: 20 Oct 2012
Total Posts: 769
20 Jun 2014 01:53 PM
repeat wait() until Players.LocalPlayer
a=Instance.new("NumberValue",Players.LocalPlayer)
a.Name = "Name here"
Report Abuse
jakej78b is not online. 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
Meowcatmaster is not online. Meowcatmaster
Joined: 20 Oct 2012
Total Posts: 769
20 Jun 2014 02:01 PM
<-- Sorry I'm used to making on enter scripts.. So I use local script alot..
Report Abuse
Typocrite is not online. 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
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
20 Jun 2014 03:24 PM
try it in start server/player. Either that or in published play
Report Abuse
Typocrite is not online. 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
Jason27993 is not online. Jason27993
Joined: 25 Sep 2010
Total Posts: 345
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 is not online. 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
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
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 is not online. 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
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