Attempt to index nil with 'PantsTemplate'

The error is in the title
It doesn’t say anything for shirt so why isn’t it working for pants?

button = script.Parent
sound = button.Ding
saveavatar = game.ReplicatedStorage.SaveAvatar
Character = workspace.CustomizableCharacter

task.wait(1)

button.Activated:Connect(function()
	sound.Playing = true
	local Clothes = {
		Character:FindFirstChildWhichIsA("Shirt",1).ShirtTemplate, Character:FindFirstAncestorWhichIsA("Pants",1).PantsTemplate, Character.BodyColors.HeadColor
	}
	saveavatar:FireServer(Clothes)
end)

I believe you meant to write: FindFirstChildWhichIsA(“Pants”)

You wrote: FindFirstAncestorWhichIsA(“Pants”)

1 Like