Arm is not rotating corretly when equipping tool after changing its rotation

I encountered a very weird bug in my script. You have to know, that I am writing an arrest tool. When Im now detaining a player who also has this tool and then releasing him again, his tool grip when equipping it is rotating in the wrong direction. The arm is in the right position. You will become 2 extracts of my server script. The part where I arrest the player and where I release the player. For your knowledge, I use a method where I make new welds and disconnect the old ones to move the arms as I want. Then I delete the new ones and connect the original ones back.

--ARRESTING
local rArm = Dchar["Right Arm"]
local lArm = Dchar["Left Arm"]
local connection1 = torso["Right Shoulder"]
local connection2 = torso["Left Shoulder"]

connection1.Part1 = nil
connection2.Part1 = nil

local weld1 = Instance.new("Weld")
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = lArm
weld1.C1 = CFrame.new(1.25, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(40), math.rad(-50), math.rad(0))
weld1.Name = "weld1"

local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = rArm
weld2.C1 = CFrame.new(-1.25, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(40), math.rad(50), math.rad(0))
weld2.Name = "weld2"


--RELEASING

torso.weld1.C1 = CFrame.new(0, 0, 0)
		
torso.weld1:Destroy()
torso.weld2:Destroy()

connection1.Part1 = lArm
connection2.Part1 = rArm

Pictures:
image
left: wrong rotation | right: correct rotation (when not arrested/released
image

You switched the connections’ Part1 to the wrong arm.

local connection1 = torso["Right Shoulder"]
local connection2 = torso["Left Shoulder"]
...
connection1.Part1 = lArm
connection2.Part1 = rArm

Here’s the correct way to do it:

connection1.Part1 = rArm
connection2.Part1 = lArm

In a thousand years I wouldnt have seen this. Thank you

1 Like

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