How to fix weld not going to the correct position and having correct rotation?
Asked by
2 years ago Edited 2 years ago
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:
01 | unequipped.OnServerEvent:Connect( function (player, name) |
02 | local character = player.Character |
03 | folder = character.Weapons |
04 | local weapon = game.ReplicatedStorage.Weapons:FindFirstChild(name) |
05 | model = weapon:Clone() |
08 | local weld = Instance.new( 'Weld' ) |
09 | weld.Parent = model.PrimaryPart |
10 | weld.Part 0 = model.PrimaryPart |
11 | weld.C 0 = CFrame.Angles(- 46.38 , 72.75 , 179.9 ) * CFrame.new( 1.9 , 5.5 , 1.3 ) |
12 | weld.Part 1 = character.Torso |
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.