Weld Constraint not welding moving parts together properly

Hello, currently making a sushi conveyor belt but am struggling to get the model’s parts to be welded and then tweened. I want the food models to be easily added by the client, so am trying to make a weld script, rather than the client having to add the welds themselves.

  1. What do you want to achieve? I want each of the parts in the model to be welded to the primary part of the model, and then when that model is tweened, the welded parts all move along with the model.

  2. What is the issue? From the picture below, you can see that the primary parts of the models are being moved along nicely, but the welded parts are staying put. I have shown the weld constraints (the green lines).

  1. What solutions have you tried so far? I have searched all over the developer forum trying to find a solution, but nothing seems to be working. I have tried using a Weld rather than Weld Constraint and then setting the C1 and C0, but that didn’t turn out right either as the welded parts did not stay in their relative positions, they ended up being welded in strange positions as you can see below (not how they are modelled):


-- Function to weld all parts within a model
local function createWelds(Model)
	if Model.PrimaryPart ~= nil then
		Model.PrimaryPart.Anchored = true
		for _, Part in pairs(Model:GetDescendants()) do
			if Part:IsA("BasePart") and not (Model.PrimaryPart == Part) then
				local Weld = Instance.new("WeldConstraint", Model.PrimaryPart)
				Weld.Part0 = Part
				Weld.Part1 = Model.PrimaryPart
				Part.Anchored = false
-- Function to move a food model to the next waypoint
local function moveToNextWaypoint(foodModel)
	local currentIndex = foodModel:GetAttribute("WaypointIndex")
	local nextIndex = currentIndex + 1

	if nextIndex <= #waypoints then
		local nextWaypoint = conveyorWaypoints["Waypoint"..tostring(nextIndex)]
		foodModel:SetAttribute("WaypointIndex", nextIndex)
		local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
		local newPos = nextWaypoint.Position
		local part = foodModel.PrimaryPart or foodModel

		local Tween = TweenService:Create(part, tweenInfo, {Position = newPos})
		if foodModel.Parent then

Thank you for taking the time to read.
couvdy :slightly_smiling_face:

1 Like

Check if the WeldConstraints that are being made are Active or not

1 Like

Yes, they are.



I had a similar thing with rotating tweening a model recently. You could either try Unioning the thing instead of modelling it, or moving each individual part.

1 Like

Unioning wouldn’t be good since the model has separate textures and mesh IDs for each part.
Also tweening each individual part would not be very efficient and I think is not very necessary since it’s something to do with the welding I think is not working properly.

Instead of tweening the position, you should try tweening the CFrame. So {[“CFrame”] = CFrame.new(newPosition)}. Weld Constraints weld for CFrames as far as I’m aware, changing position itself is the same as changing the offset of a part for a Weld.

You should check this post out: Introduction to Tweening Models

Other things to note:

  • Make it more clear what the problem was (I thought you were having trouble with welding and Tweening, turns out, it was just tweening)

  • You don’t really need to use ipairs or pairs anymore, as stated from this guy:

That has worked to an extent. The model now moves together as one, however I am still experiencing the issue whereby the positioning of the parts are not relative to their original position. They are off-centered / out of position when they should be just as the food model is already. Do you know how I would go about correcting this?

Thanks for your response. I did in fact check out that article previously, but nothing seemed to help. And to be clear, I thought the issue was to do with welding - which I am pretty sure it still is, so you would not be incorrect in saying that (unless I am mistaken). Thank you for the other notes, will take those on board also.

This is the current issue I am facing which I have just posted: Weld Constraint not welding moving parts together properly - #8 by couvdy

Whether it’s to do with the tweening (don’t think so since it moves perfectly fine now) or the welding (seems like it) I am not entirely sure…

I think I see your problem. When you use the create welds function, I’m assuming the parts are offset for some reason. You should manually try welding them, then use :Clone() on the already welded one to see if that is the issue. Otherwise, I’m assuming the issue is somewhere before the code you provided.

Thank you, I noticed all of the parts were all slightly offset so the welding wasn’t turning out right. :+1:

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