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

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

Asked by 10 years ago

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)
0
Wouldn't you want to do copiedhead.BrickColor = head.BrickColor? Spongocardo 1991 — 10y

2 answers

Log in to vote
0
Answered by
Trewier 146
10 years ago

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)

0
It did not work. The output said luasnake 0 — 10y
0
Workspace.Insertation:35: bad argument #1 to 'new' (Color3 expected, got userdata) luasnake 0 — 10y
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 Epidemiology 116 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

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.

0
nope :C luasnake 0 — 10y

Answer this question