Help positioning a weld

I have a belt that I’ve cloned from ReplicatedStorage, attached, and welded to a player’s torso (happens after they click a button).

The belt successfully clones and welds (using WeldConstraints), but is not in the right position. I’ve tried a dozen things with Vector3 but am unsure how to proceed.

The Issue

https://gyazo.com/fa3f2b281796bc36835e6df7f0f86dd3

Object's Orientation

https://gyazo.com/505af3e3bdf73659adb92fce230734ee

My Code
local button = script.Parent
local clickDetector = button.ClickDetector

local belt = game.ReplicatedStorage.Belt

clickDetector.MouseClick:Connect(function(plr)
	local char = plr.Character
		
	if char:FindFirstChildOfClass("Humanoid") then
		button.BrickColor = BrickColor.new("Really red")
		
		local chest = char.Torso
		local clonedBelt = belt:Clone()
		
		clonedBelt.Parent = char
				
		local weld = Instance.new("WeldConstraint")		
			weld.Parent = clonedBelt.BeltPrimaryPart
			weld.Part0 = clonedBelt.BeltPrimaryPart
			weld.Part1 = chest
		
		clonedBelt.BeltPrimaryPart.Position = clonedBelt.BeltPrimaryPart.Position.Vector3.new(chest.Position.X, chest.Position.Y, chest.Position.Z + 15)
		char.Torso.
		print("Step 4")
		
	end
end)

I can mess around with the specific numbers, but how would I get the belt to begin based off my torso’s location?

Thanks!

1 Like

So I found a solution that only uses the player’s torso and the belt.

The easiest way I use to change the weld’s position is to change the CFrame of the weld.

local button = script.Parent
local clickDetector = button.ClickDetector

local belt = game.ReplicatedStorage.Belt

clickDetector.MouseClick:Connect(function(plr)
	local char = plr.Character

	if char:FindFirstChildOfClass("Humanoid") then
		button.BrickColor = BrickColor.new("Really red")

		local chest = char.Torso
		local clonedBelt = belt:Clone()

		clonedBelt.Parent = char
		clonedBelt.CFrame = chest.CFrame -- Setting the position of the belt to the players torso

		local weld = Instance.new("Weld", clonedBelt.Parent) -- Using Weld instead of WeldConstraint, seems to work better
		weld.Part0 = clonedBelt
		weld.Part1 = chest
		weld.C0 = CFrame.new(0, 0.8, 0) * CFrame.Angles(math.rad(90), 0, math.rad(90)) -- Change C0 on the Y-Axis here to change the position of the belt, up and down
		weld.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(90), 0, math.rad(90))

		print("Step 4")
	end
end)

Using this method it should look something like this hopefully.

Using the method preview:

https://gyazo.com/232d65cf057fbed42df55218fdd80831

Hope this helps! :slightly_smiling_face:

1 Like

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