So ya im making a value script and i dont really know why it wont work to make a new value into the player
game.Players.PlayerAdded:connect(function(p)
Instance.new("IntValue")
end)
So ya im making a value script and i dont really know why it wont work to make a new value into the player
game.Players.PlayerAdded:connect(function(p)
Instance.new("IntValue")
end)
Easy, you are not setting the parent of the IntValue that you have just made. Try this:
game.Players.PlayerAdded:connect(function(p)
local lvl = Instance.new("IntValue") -- Creates the IntValue.
lvl.Name = "level4" -- Sets the name of the IntValue.
lvl.Value = 0 -- Sets the value of the IntValue to 0.
lvl.Parent = p -- Sets the newly created IntValue's parent to the player.
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.
game.Players.PlayerAdded:connect(function(p) --Create the function
local val = Instance.new("IntValue",p) --Add IntValue to the player
val.Name = "Level4" -- Rename it to Level4
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
yup, thanks but i need to name it to like level4
Edited
Thanks