So ya im making a value script and i dont really know why it wont work to make a new value into the player
1 | game.Players.PlayerAdded:connect( function (p) |
2 | Instance.new( "IntValue" ) |
3 | end ) |
Easy, you are not setting the parent of the IntValue that you have just made. Try this:
1 | game.Players.PlayerAdded:connect( function (p) |
2 | local lvl = Instance.new( "IntValue" ) -- Creates the IntValue. |
3 | lvl.Name = "level4" -- Sets the name of the IntValue. |
4 | lvl.Value = 0 -- Sets the value of the IntValue to 0. |
5 | lvl.Parent = p -- Sets the newly created IntValue's parent to the player. |
6 | end ) |
Hoped this helped.
Based off of what UltChowsk gave you can re-name the value quite easily. Your best bet would make the whole thing a variable and change it that way.
1 | game.Players.PlayerAdded:connect( function (p) --Create the function |
2 | local val = Instance.new( "IntValue" ,p) --Add IntValue to the player |
3 | val.Name = "Level4" -- Rename it to Level4 |
4 | end ) |