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

How do I make a fakehead's color the same as the real head?

So I have a script that inserts a fakehead into the character and changes the character's head transparency to 0. Whenever I do fakehead.BrickColor = character.Head.BrickColor it would not work.

Script:

--Starting insertation..
game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		local gui = game.ServerStorage:WaitForChild('NameGui')
		local humanoid = character:WaitForChild('Humanoid')
		local head = character:WaitForChild('Head')
		
		
		local teamcolor = player.TeamColor
		
		if gui and humanoid and head ~= nil then
			local copiedhead = head:Clone()
			copiedhead.Name = 'CopiedHead'
			copiedhead.Parent = character
			head.Transparency = 1
			copiedhead.Transparency = 0
			local copiedgui = gui:Clone()
			local weld = Instance.new('Weld')
			weld.Parent = copiedhead
			weld.Part0 = copiedhead
			weld.Part1 = head
			copiedgui.Name = 'NameGui'
			copiedgui.Parent = copiedhead
			
		end
		
		
		
		
	end)
end)

1 comment

0

Wouldn't you want to do copiedhead.BrickColor = head.BrickColor?

2 answers

fakehead.BrickColor = character.Head.BrickColor

Will not work, I believe it is because you are trying to assign userdata to BrickColor. You should instead use BrickColor.new(color) to assign it.

Like so: fakehead.BrickColor = BrickColor.new(character.Head.BrickColor)

3 comments

0

It did not work. The output said

0

Workspace.Insertation:35: bad argument #1 to 'new' (Color3 expected, got userdata)

0

Of course you are going to assign a userdata to it, that is why BrickColor = 'Really red' would not work, BrickColor.new takes a string (the color name) or userdata (Color3) to also to get the name of a brick color you do BrickColor.Name

Well, assuming fakehead does not even exist as a variable in the script, I would suggest using the following line of code in your script:

copiedhead.BrickColor = character.Head.BrickColor

This should work. If not, put down a comment.

1 comment

0

nope :C

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