I have been messing with the "fromEulerAnglesXYZ" for a hour trying to change the rotation of the weapon when the player is holding it and I can't change the rotation at all. could anyone please explain how I would?
Tool = script.Parent;
local humanoid = nil
local arms = nil
local torso = nil
local welds = {}
function Equip(mouse)
wait(0.01)
humanoid = Tool.Parent:WaitForChild("Humanoid")
if humanoid.RigType == Enum.HumanoidRigType.R15 then
arms = {Tool.Parent:FindFirstChild("LeftUpperArm"), Tool.Parent:FindFirstChild("RightUpperArm"),Tool.Parent:FindFirstChild("LeftLowerArm")}
torso = Tool.Parent:FindFirstChild("UpperTorso")
if arms ~= nil and torso ~= nil then
local sh = {arms[1]:FindFirstChild("LeftShoulder"), arms[2]:FindFirstChild("RightShoulder"),arms[3]:FindFirstChild("LeftElbow")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = nil
sh[2].Part1 = nil
sh[3].Part1 = nil
local weld1 = Instance.new("Weld")
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arms[1]
weld1.C1 = CFrame.new(1, 0.2, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(50), 0)
welds[1] = weld1
local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-1.2, -0.2, 0.15) * CFrame.fromEulerAnglesXYZ(math.rad(-75), math.rad(-10), 0)
welds[2] = weld2
local weld3 = Instance.new("Weld")
weld3.Part0 = torso
weld3.Parent = torso
weld3.Part1 = arms[3]
weld3.C1 = CFrame.new(1, 0.8, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(50), 0)
welds[3] = weld3
end
end
end
else
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
torso = Tool.Parent:FindFirstChild("Torso")
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = nil
sh[2].Part1 = nil
local weld1 = Instance.new("Weld")
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arms[1]
weld1.C1 = CFrame.new(-0.249, 1, 1) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0, math.rad(-90))
welds[1] = weld1
local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-1.15,.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
welds[2] = weld2
end
end
end
end
end
function Unequip(mouse)
if humanoid.RigType == Enum.HumanoidRigType.R15 then
if arms ~= nil and torso ~= nil then
local sh = {arms[1]:FindFirstChild("LeftShoulder"), arms[2]:FindFirstChild("RightShoulder"),arms[3]:FindFirstChild("LeftElbow")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
sh[3].Part1 = arms[3]
welds[1]:Destroy()
welds[2]:Destroy()
welds[3]:Destroy()
end
end
end
else
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
welds[1].Parent = nil
welds[2].Parent = nil
end
end
end
end
end
Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)
