Is this a bug or scripting error on my end?

So I am working on character customization and this bug has been persistent.

function UpdateHair()
	local Race = RaceModule:GetInfo(Data.Race.Value)
	
	if Race.HasHair then
		for _, Accessory in pairs(Character:GetChildren()) do
			if Accessory:IsA("Accessory") and Accessory.AccessoryType == Enum.AccessoryType.Hair then
				local SM = Accessory.Handle:FindFirstChildWhichIsA("SpecialMesh")

				if SM then
					SM.TextureId = " "
					SM.VertexColor = Vector3.new(Data.HairR.Value, Data.HairG.Value, Data.HairB.Value)
				end

				if Accessory.Handle:IsA("MeshPart") then
					Accessory.Handle.TextureID = ""
					Accessory.Handle.Color = Color3.fromRGB(Data.HairR.Value, Data.HairG.Value, Data.HairB.Value)
					Accessory.Handle.Material = Enum.Material.SmoothPlastic
				end

				Accessory.Handle.Color = Color3.fromRGB(Data.HairR.Value, Data.HairG.Value, Data.HairB.Value)
			elseif Accessory:IsA("Accessory") and Accessory.AccessoryType ~= Enum.AccessoryType.Hair then
				Accessory:Destroy()
			end
		end
	end
end

I know its this script because I disabled it and tested 3 times and the bug did not appear once.

It causes to mess with the view port.
image

In addition, in game is messed up.
image

However in the server it appears as normal.
image

Any thoughts?

1 Like

Nvm I figured it out. xxxxxxxxxxxxx