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

Constraints and Attachments, why won't they work?

I'm trying to create hinge joints in between parts of a model below, and it shows the attachments, but there is no change, and no hinge movements going on. All the parts in the model are unanchored. I also tried attaching the first part of the chain to an anchored part via weld, but the first part just fell down with the rest of the chain. It makes no sense, any help is appreciated!

parts = game.Workspace.Parts:GetChildren();

start = parts[1].Position
finish = parts[#parts].Position + Vector3.new(0,5,0)

for i = 1, #parts do
	local part = parts[i]
	local attachmentA
	local attachmentB
	if(i < #parts) then
		attachmentA = Instance.new("Attachment", part) 
		attachmentA.Position = attachmentA.Position + Vector3.new(0, 0, -part.Size.z/2)
	end
	if(i > 1)then
		attachmentB = Instance.new("Attachment", part) 
		attachmentB.Position = attachmentB.Position + Vector3.new(0, 0, part.Size.z/2)
	end
	if((i > 1) and (i < #parts)) then
		local hingeConstraint = Instance.new("HingeConstraint", part)
		hingeConstraint.Attachment0 = attachmentA
		hingeConstraint.Attachment1 = attachmentB
	end
end

1 answer

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