If you don't have an item, you can't get it?

So the title may have been confusing, but basically, I have this beard receiver, that if you have a beard, it gets destroyed and replaced by the new one, if you don’t have a beard, you just get it, but it does not work, and sense I do not have a beard, it gives me an error saying beard is not a member of character. meaning my script does not work, any help?

game.ReplicatedStorage.Beards.OnServerEvent:Connect(function(plr, beard, color)
	if plr.Character.Beard then
		plr.stats.Money.Value = plr.stats.Money.Value - 15
		for _,v in pairs(game.ReplicatedStorage.Beard:GetChildren()) do
		if beard == v.Name then
		plr.Character.Beard:Destroy()
	plr.stats.HairColor.Value = tostring(color)		
	plr.stats.Beard.Value = beard
	local cc = game.ReplicatedStorage.RealBeards:FindFirstChild(beard):Clone()
	cc.Parent = workspace
	cc.Handle.BrickColor = color
	cc.Name = "Beard"
plr.Character.Humanoid:AddAccessory(cc)
			elseif not plr.Character.Beard then
	plr.stats.HairColor.Value = tostring(color)		
	plr.stats.Beard.Value = beard
	local cc = game.ReplicatedStorage.RealBeards:FindFirstChild(beard):Clone()
	cc.Parent = workspace
	cc.Handle.BrickColor = color
	cc.Name = "Beard"
plr.Character.Humanoid:AddAccessory(cc)
			
			
	end
	end
	end
		end)
1 Like

Ok basically,dont add an Accessory to the Humanoid just do plr.Character:AddAccessory(cc)

1 Like

Also try to indent your code better,make it neater