I’m trying to have a sword be placed into the players hand when I equip it, everything works correctly at orientation 0,0,0 but if you turn at all the sword isn’t in the correct place at all.
Code:
How do you position it? Is it done every frame, or similar?
Either way, I think using welds would be a better use case for this:
local GripWeld = Instance.new("Weld")
GripWeld.Part0 = char:FindFirstChild("Right Arm")
GripWeld.Part1 = Sword.Handle
GripWeld.C0 = CFrame.new(0, 1, 0) * CFrame.Angles(0, math.rad(90), *math.rad(-90))
GripWeld.Parent = Sword.Handle
local SwordWeld = Instance.new("Weld")
SwordWeld.Part0 = Sword.Handle
SwordWeld.Part1 = Sword.Sword
-- i don;t know what your sword model looks like so im guessing based off your code
SwordWeld.C0 = CFrame.new(-.1,-.868,-.05) * CFrame.Angles(0, math.rad(0), math.rad(180))
SwordWeld.Parent = Sword.Sword
Ok, sorry for the confusion, I didn’t explain well. I’ve already done that, after setting the CFrame I welded the Handle part to the players right arm. But, based on where you’re looking the orientation of the sword would be different. For example, if the players orientation was 0,0,0 the sword would look right. But if you turn at all it messed up the swords orientation.
It really only is supposed to position itself in the correct spot and then weld to the players arm, but the positioning gets messed up if you arent at orientation 0,0,0
It’s the entire relevant part of the script. It sets the position and the welds it to the arm, it’s simple.
I’m sure
the problem is something i dont understand about CFrames, so i wanted someones opinion on it. The rest of the script is just equipping the tool.