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

Hide character head if on specific team not working?

This script is perfectly fine except for one line, which is the head transparency part. Is anyone able to fix this? Thanks.

game.Players.PlayerAdded:connect(function(Plr)
    Plr.CharacterAdded:connect(function(Char)
        wait(0.5)
        local Contents = Char:GetChildren()
        for _, v in pairs(Contents) do
            if v:IsA("Accessory") then
                v:remove()
            end
        end
        if Plr.TeamColor == BrickColor.new("Bright blue") then
            local Hat1 = game.ServerStorage.Hat1:Clone()
            Hat1.Parent = Char
			Char.Parent:findFirstChild("Head").Transparency = 1 --THIS LINE
        end
    end)
end)

1 answer

You have Char.Parent to find the head when right before, Char was the character.

game.Players.PlayerAdded:connect(function(Plr)
    Plr.CharacterAdded:connect(function(Char)
        wait(0.5)
        local Contents = Char:GetChildren()
        for _, v in pairs(Contents) do
            if v:IsA("Accessory") then
                v:remove()
            end
        end
        if Plr.TeamColor == BrickColor.new("Bright blue") then
            local Hat1 = game.ServerStorage.Hat1:Clone()
            Hat1.Parent = Char
            Char:FindFirstChild("Head").Transparency = 1
        end
    end)
end)

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