Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

I cant possible know why this is happening?

Asked by
DevingDev 346 Moderation Voter
7 years ago

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)

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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.

0
yup, thanks but i need to name it to like level4 DevingDev 346 — 7y
0
Edited UltChowsk 85 — 7y
0
Thanks DevingDev 346 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

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)

Answer this question