Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Won't insert NumberValue into a Robloxians Head?

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

✓ Accepted answer

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.

6 comments

0

I checked it out in Studio but it didn't insert it?

0

Your supposed to check Game.Players.whateverthelayeris's children. You should see the following: Backpack,PlayerGui,StarterGear,Tacos

0

Ye, I made it in a LocalScript in Workspace and I don't see "Tacos" inside the Children

0

insert it into a server script T_T

0

LocalScripts don't even WORK in Workspace -.-

0

Lol thank's

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)

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.