R15 Head, unable to find attachments upon loading

issue:

im trying to attach an attachment to a align constraint, the server isnt finding it as the head doesnt seem to load on par with its attachments and its really annoying.

the ‘FaceCenterAttachment’ is what i need as its precision in the center of head helps alot. But the script can’t find it as it has some delay on loading.

i added a task.wait() - im sure it worked before but now it doesn’t…

output:

  17:02:58.575   ▼  {
                    [1] = FaceControls,
                    [2] = HeadWrapTarget,
                    [3] = FaceFrontAttachment,
                    [4] = HatAttachment,
                    [5] = HairAttachment,
                    [6] = FaceCenterAttachment,
                    [7] = NeckRigAttachment,
                    [8] = AvatarPartScaleType,
                    [9] = Neck,
                    [10] = OriginalSize
                 }  -  Server - Module:40

local module = {}

-- //
local Points = script.Parent:WaitForChild("Points")

-- //
local PointsParts = {
	["HeadPoint"] = Points:FindFirstChild("HeadPoint"):Clone(),
	["RightPoint"] = Points:FindFirstChild("RightPoint"):Clone(),
	["LeftPoint"] = Points:FindFirstChild("LeftPoint"):Clone()
}

local IKControls = {
	["IKHead"] = Instance.new("IKControl"),
	["IKRight"] = Instance.new("IKControl"),
	["IKLeft"] = Instance.new("IKControl"),
}

local Alignments = {
	["AlignPosition"] = Instance.new("AlignPosition"),
	["AlignOrientation"] = Instance.new("AlignOrientation")
}

-- //
local property = {
	Head = 0,
	Torso = 0,
	RightArm = 0,
	LeftArm = 0,
	RightLeg = 0,
	LeftLeg = 0
}

function module:Module(player, character)
	
	-- //
	local Head = character:WaitForChild("Head")
	
	if Head then
		print(Head:GetChildren())
	end
	
	-- //
	local IKIndex = {
		["IKHead"] = {Type = Enum.IKControlType.Rotation, ChainRoot = character:FindFirstChild("UpperTorso"), EndEffector = character:FindFirstChild("Head"), Target = PointsParts["HeadPoint"]},
		["IKRight"] = {Type = Enum.IKControlType.Transform, ChainRoot = character:FindFirstChild("RightUpperArm"), EndEffector = character:FindFirstChild("RightHand"), Target = PointsParts["RightPoint"]},
		["IKLeft"] = {Type = Enum.IKControlType.Transform, ChainRoot = character:FindFirstChild("LeftUpperArm"), EndEffector = character:FindFirstChild("LeftHand"), Target = PointsParts["LeftPoint"]}
	}
	
	local AlignIndex = {
		["HeadPoint"] = {Attachment0 = PointsParts["HeadPoint"]:FindFirstChild("HeadCenterAttachment"), Attachment1 = character:WaitForChild("Head"):FindFirstChild("FaceFrontAttachment")},
		["RightPoint"] = {Attachment0 = PointsParts["RightPoint"]:FindFirstChild("RightCenterAttachment"), Attachment1 = character:FindFirstChild("RightHand"):FindFirstChild("RightGripAttachment")},
		["LeftPoint"] = {Attachment0 = PointsParts["LeftPoint"]:FindFirstChild("LeftCenterAttachment"), Attachment1 = character:FindFirstChild("LeftHand"):FindFirstChild("LeftGripAttachment")}
	}
	
	-- //
	local Humanoid = character:WaitForChild("Humanoid")
	local BodyColors = character:FindFirstChild("Body Colors")
	local GetAppliedDescription = Humanoid:GetAppliedDescription()
	local Animate = character:FindFirstChild("Animate")
	
	if Animate or Humanoid then
		Animate:Destroy()
		Humanoid.HipHeight = 2
	end 

	PointsParts["RightPoint"].Color = BodyColors.RightArmColor3
	PointsParts["LeftPoint"].Color = BodyColors.LeftArmColor3	

	for _, data in pairs(property) do
		GetAppliedDescription[_] = data
	end

	Humanoid:ApplyDescription(GetAppliedDescription)
	
	for _, ik in pairs(IKControls) do
		ik.Name = _
		ik.Parent = Humanoid
		for a, index in pairs(IKIndex) do
			for b, data in pairs(index) do
				if a == ik.Name then
					ik[b] = data
				end
			end
		end
	end
	
	for _, obj in pairs(PointsParts) do
		
		if not character:FindFirstChild(_) then
			obj.Parent = character
		end
		
		for a, align in pairs(Alignments) do
			-- //Clone
			local Clone = align:Clone()

			if not obj:FindFirstChild(Clone.Name) then
				Clone.Parent = obj
			end
	
			for b, index in pairs(AlignIndex) do
				for c, data in pairs(index) do
					if b == Clone.Parent.Name then
						Clone[c] = data
					end
				end
			end

			Clone.Responsiveness = 200

			if Clone:IsA("AlignPosition") then
				Clone.ReactionForceEnabled = true
				Clone.MaxVelocity = 0
			elseif Clone:IsA("AlignOrientation") then
				Clone.ReactionTorqueEnabled = true
				Clone.MaxAngularVelocity = 0
			end

		end
		obj:SetNetworkOwner(player)
	end
	
	for _, joint in ipairs(character:GetDescendants()) do
		if joint:IsA("Motor6D") and (string.match(joint.Name, "Hip")) then
			joint:Destroy()
		end
	end

	for _, part in ipairs(character:GetChildren()) do
		if part:IsA("BasePart") then
			
			part.CollisionGroup = "Virtual"
			
			
			if string.match(part.Name, "Leg") then
				part:Destroy()
			end
			
		end
	end
	
end

return module

i’m probably being dumb and not figuring this out - also in my code i changed the path to FaceFrontAttachment instead of FaceCenterAttachment to see if that would get found. Still no output.

fixed - placement of task.wait had to be above the align index - and i changed the code block of the humanoid description at the bottom

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.