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

Won't insert NumberValue into a Robloxians Head?

Asked by 10 years ago

I want to make it so when a Player joins, it inserts a NumberValue in their head, because I am making a client sided game, but this Script won't work:

V = Instance.new("NumberValue")

Workspace.ChildAdded:connect(function(child)
    print(child.Name)
    wait()
    V.Parent = child.Head
    V.Name = "Tacos"
end)

3 answers

Log in to vote
-1
Answered by 10 years ago

All it takes is these 5 simple lines of code :D

game.Players.PlayerAdded:connect(function(plr)
    print(plr.Name)
    local v = Instance.new("NumberValue",plr)
    v.Name = "Tacos"
end)

It's best that you insert the number value inside the player. For example, if they die or reset, you won't lose that current value.

0
I checked it out in Studio but it didn't insert it? ScriptingHelpersALT 20 — 10y
0
Your supposed to check Game.Players.whateverthelayeris's children. You should see the following: Backpack,PlayerGui,StarterGear,Tacos TochiWasHere 10 — 10y
0
Ye, I made it in a LocalScript in Workspace and I don't see "Tacos" inside the Children ScriptingHelpersALT 20 — 10y
0
insert it into a server script T_T TochiWasHere 10 — 10y
View all comments (2 more)
0
LocalScripts don't even WORK in Workspace -.- TochiWasHere 10 — 10y
0
Lol thank's ScriptingHelpersALT 20 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

Here ill try to help out

Code:

game.Players.PlayerAdded:connect(function(Player)
    print(Player.Name .. " Has joined the game.")
    Player.CharacterAdded:connect(function(Character)
    local V = Instance.new("NumberValue", Character:WaitForChild("Head")) -- Instance.new(Class, Parent)
    V.Name = "Tacos"
    end)
end)
Log in to vote
-1
Answered by 10 years ago

Try this instead.

game.Players.PlayerAdded:connect(function(player)--The function is called when player joins
print(player.Name)--Prints his/her name
wait()
local V = Instance.new("NumberValue", player.Character.Head)--Inserts into the head
V.Name = "Tacos"
end)

Answer this question