Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to fix weld not going to the correct position and having correct rotation?

I have been trying to make a sword attach to the back when unequipped, but I cannot get the position and orientation correct. I have tried multiple times and tried multiple different solutions and cannot seem to find an answer. I thought that getting the position of the characters torso and the position of the primarypart of the model and then subtracting the model's position from the torso's position would work, but it makes the model be in a spot it shouldn't. I have also tried centering the player at 0,3,0 and trying that way, but that also did not work. I also have to test the sword position in game due to the custom idle animation moving the torso.

This is my code:

unequipped.OnServerEvent:Connect(function(player, name)
	local character = player.Character
	folder = character.Weapons
	local weapon = game.ReplicatedStorage.Weapons:FindFirstChild(name)
	model = weapon:Clone()
	model.Parent = folder

	local weld = Instance.new('Weld')
	weld.Parent = model.PrimaryPart
	weld.Part0 = model.PrimaryPart
	weld.C0 = CFrame.Angles(-46.38, 72.75, 179.9) * CFrame.new(1.9, 5.5, 1.3)
	weld.Part1 = character.Torso
end)

Any help would be very appreciated, I have been trying for ages and my friend cannot do the unsheathe animation until the weld position is fixed.

1 answer

I went in game, anchored the model, moved it into position, and then used a weld plugin to correctly weld it. After that I used the console to print the C0 and C1 values of the weld. Now it works.

This discussion is preserved as it was. New answers, comments, and votes are closed.