Trying to understand qPerfectionWeld

So I’m working on a pirate game, And I want a ship to move on it’s own. So my solution to this was to anchor a single part of the ship model and tween it’s position, But soon I realized qPerfectionWeld unanchors all parts of the model, So I skimmed through the script trying to look for a fix and found this section:

local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
	-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
	-- @param MainPart The part to weld the model to (can be in the model).
	-- @param [JointType] The type of joint. Defaults to weld. 
	-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
	
	for _, Part in pairs(Parts) do
		if ShouldBreakJoints(Part) then
			Part:BreakJoints()
		end
	end
	
	for _, Part in pairs(Parts) do
		if Part ~= MainPart then
			WeldTogether(MainPart, Part, JointType, MainPart)
		end
	end

	if not DoNotUnanchor then
		for _, Part in pairs(Parts) do
			Part.Anchored = false
		end
		MainPart.Anchored = false
	end
end

It mentions something about a MainPart, Though “MainPart” is not identified anywhere else in the script. It looks like I could change MainPart.Anchored = false to MainPart.Anchored = true if I could identify what the mainpart is/where the mainpart is. Any and all help would be appreciated :sweat_smile:

P.S. sorry if this is confusing, pls feel free to ask questions!

1 Like

Just set the DoNotUnanchor boolean to true.

1 Like

Make the part you want to tween the ship separate from the actual model and then use a weld constraint and weld the tween part to the ship

Aalso, I think the mainpart may be the primarypart

1 Like

I agree with this post, this would be the easiest way and you won’t have to change the script.

I tried, But it doesn’t seem to work for me
Here’s my serverscript:

local TweenService = game:GetService("TweenService")
local MainPart = workspace.MainPartMove

task.wait(10)
local tweeninfo = TweenInfo.new(60)
local target = workspace.ShipTarget
local tween = TweenService:Create(MainPart, tweeninfo, target.Position)

tween:Play()

(“MainPartMove” is the part welded to the ship and I think “Target” is pretty self-explanatory)
Spot anything wrong?

1 Like

I’m not sure, but you should probably try to get the part to move before you try welding it to the ship. I think you may not have put the tween goal in correctly(but i’m not sure how its done):

I thought the goal would need to be formatted like {Position = whatever.Position}
or maybe you need to tween the CFrame? idk

As far as I know this is a legitimate method…
The model is a humanoid, Would that affect anything?