Welding a local-sided model to a server-sided unanchored part will locally teleport the part

Hello,

I’ve been fighting with this issue the whole day and I’m at a loss.

To explain what’s basically happening:
• I call a player’s ability to spawn a medkit interactable.
• The medkit interactable tells every client to load a model into the interactable part.
• The locally spawned model gets all its properties set to not collide at all, and then gets welded into the interactable part.

This should be it, but for some reason, some models just locally move the interactable part to themselves.

Example of the issue: 2023-01-22 20-08-34

Codes:

--- LOAD LOCAL MODEL 
local module = function(modelName, toParent:Part, toNickname)
	local success, model = fetchLocalModelInfo(modelName);
	
	if	(success)	then
		local clone = model:Clone();
		local main = clone.PrimaryPart;
		
		---

		setModelProperties(clone, {
			collision_group = "RenderModels";
--- can_collide = false, anchored = false, can_query = false, can_touch = false;
		}, true);
		
		weldAll(clone);
		
		--- THIS IS THE ISSUE PART
		weldParts(toParent, main, main, nil, false, false);

		---

		clone.Name = toNickname or modelName;
		clone.Parent = toParent;
		
		return clone;
	end;
end;
--- WELD PARTS FUNCTION

local module = function(primary:Part, secondary:Part, weldParent:Folder, weldType, inverse, inheritProperties)

	if	not (isWeldable(primary) and isWeldable(secondary))	then
		return;
	end;

	---

	local weld;
	local weldTypes = {"Weld", "Motor6D", "WeldConstraint"};

	if	(weldType and table.find(weldTypes, weldType))	then
		weld = Instance.new(weldType);
	else
		weld = Instance.new("Weld");
	end;

	--- 

	weld.Part0 = primary;
	weld.Part1 = secondary;

	if	(inverse)	then
		weld.C0 = primary.CFrame:Inverse();
		weld.C1 = secondary.CFrame:Inverse();
	end;

	if	(inheritProperties)	then
		local inheritedProperties = getPartProperties(primary);
		applyPartProperties(secondary, inheritedProperties, true);
	end;

	weld.Name = primary.Name..">"..secondary.Name;
	weld.Parent = weldParent;

	return weld;

end;

Found this: When editing a motor's C0/C1, Part0 gets moved instead of Part1 - #6 by EchoReaper

After making the ammo pack’s model the size of a peanut, it no longer snaps the interactable parts, so stupid, wonder if there’s a way to choose the dominant weld part.

I fixed this issue by making the interactable part unreasonably big, and then changing its size back to normal once its all welded.

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