Welding a model to the back of a player's character

I’m having problems welding a model to the character.

I want the model to go on the player’s back, or rather, welded behind the UpperTorso.

Right now, the model welds to the player like so:

image

This is not the intended behavior, and I don’t really know how to translate the model’s position to be behind the player.

Here’s the code for the event on the server:

Player.CharacterAdded:Connect(function(Char)
	Char:WaitForChild("HumanoidRootPart")
	Char:WaitForChild("Head")
	
	wait()
	
	Char:MoveTo(Plot.Position + Vector3.new(0, 10))
	
	local Backpack = script.Model:Clone()
	Backpack.Parent = Char
	Backpack.qPerfectionWeld.Disabled = false
	
	Backpack:MoveTo(Char.UpperTorso.Position)
	
	local Weld = Instance.new("WeldConstraint")
	Weld.Parent = Backpack.PrimaryPart
	Weld.Part0 = Backpack.PrimaryPart
	Weld.Part1 = Char.UpperTorso
	Weld.Enabled = true
end)

Any help?

4 Likes

I think in this case a ManualWeld would be more suitable than a WeldConstraint

With the manual weld it looks very similar to what you’re doing currently, but gives you a Weld.C0 and a Weld.C1 you can see more details on C0 and C1 here https://staging.robloxdev.com/en-us/api-reference/class/Weld

If you set the C0 on the Weld to something like Weld.C0 = CFrame.new(0,0,4) that might be about right. (Just spitballing on that CFrame though so you may need to change it.)

Hope that’s helpful.

3 Likes

MoveTo needs a vector, and this normally causes collision which forces the object to the top surface of the object. You’d want to use a CFrame.

Backpack:SetPrimaryPartCFrame(Plot.CFrame * CFrame.new(0, 0, 5))

Also, i’d advise using a normal Weld instance, because WeldConstraints can get a little complicated. Welds have a Part0 and Part1 like WeldConstraints, but how the part1 is positioned is by using the C0 and C1 properties, which are relative offsets from Part0’s CFrame and C0’s value respectively. If you set the weld’s C0 to like: 0, 0, 6 or something, it should work fine.

For more information about welds, you can refer to the link @CompilerError posted

This works well, thank you!

I didn’t even know that these kinds of things existed.

1 Like

If you ever have downtime just take a look around the wiki, or the Object Browser in studio. There’s a ton of information on all of the instance types in Roblox

1 Like