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

How can i insert a lot of constraints quickly?

So basically, I need to insert a whole bunch of constraints, there are like 60 parts so if i was to do it manually it would take a long time. I tried using a for loop but it doesn't appear to be doing anything:

for i,v in pairs(pet:GetChildren())do
	if v.Name ~= "Hitbox" and v:IsA("BasePart") then
		local constraint = Instance.new("WeldConstraint")
		constraint.Name = "WeldConstraint"
		constraint.Parent = script.Parent:WaitForChild("Hitbox")
		constraint.Part0 = script.Parent:WaitForChild("Hitbox")
		constraint.Part1 = v
	end
end

Basically, what this script is supposed to do, is that, in the model, it gets the children of the model, then for every part, it will create a weld constraint in the hitbox part, witht the hitbox being the first attatchment and the part as the second attachment. There are no errors, but i don't think it's working. The model is in replicated storage because i need to clone it.

Is there a way to make this script work, or a quick way to manually do it?

Thanks!!!

1 answer

I would recommend using the roblox studio plugin "Moon Animator"'s easy weld feature. This feature works by taking a model and welding every part to one specified part.

1 comment

0

Unfortunately, i need Weld constraints. Is there a way to do this?

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