Why do the arms flip sides?

I dont know what i did wrong but the arms now just switch sides
uh
What they are supposed to look like
image

What they look like
image
(after they get unanchored)
Code

local Player = game:GetService("Players").LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()
Character.Archivable = true
repeat task.wait() until game:IsLoaded()
local sf = string.find

local viewmodel = Instance.new("Model")
viewmodel.Name = "ViewModel"

local ClonedChar = Character:Clone()

local RootPart

for Num, Part in ipairs(ClonedChar:GetChildren()) do
	local name = Part.Name:lower()
	
	if not sf(name, "hand") and not sf(name, "arm") and not sf(name, "head") then
		if not Part:IsA("Humanoid") and not Part:IsA("Shirt") and not string.find(Part.Name:lower(), "root") then
			Part:Destroy()
		elseif Part:IsA("Humanoid") then
			Part.Parent = viewmodel
			for i, v in ipairs(Part:GetChildren()) do
				if not v:IsA("Animator") then v:Destroy()end
			end
		elseif string.find(Part.Name:lower(), "root") then
			RootPart = Part
			Part.Parent = nil
			Part.Size = Vector3.new(.75,.75,.75)
			Part.CanCollide = false
			Part.CanQuery = false
			Part.CanTouch = false
			Part.Transparency = 1
			Part.Anchored = true
		else
			Part.Parent = viewmodel
		end
	else
		if not Part:IsA("MeshPart") then
			Part:Destroy()
		else
			Part.Anchored = true
			Part.Parent = viewmodel
			for i, v in ipairs(Part:GetChildren()) do
				if not v:IsA("Motor6D") then
					v:Destroy()
				end
			end
		end
	end
end
ClonedChar:Destroy()
viewmodel.Parent = workspace.Camera
local Humanoid = viewmodel:WaitForChild("Humanoid")

local CameraPart = Instance.new("Part"); CameraPart.Name = "CameraPart"
CameraPart.Anchored = true
CameraPart.CanCollide = false
CameraPart.Size = Vector3.new(.75,.75,.75)
CameraPart.Parent = viewmodel
CameraPart.CFrame = viewmodel:WaitForChild("Head").CFrame
viewmodel:WaitForChild("Head"):Destroy()

Humanoid.Parent = nil
RootPart.Parent = viewmodel
RootPart.CFrame = CameraPart.CFrame

local LeftHand = viewmodel:WaitForChild("LeftHand")
local LeftLowerArm = viewmodel:WaitForChild("LeftLowerArm")
local LeftUpperArm = viewmodel:WaitForChild("LeftUpperArm")

local RightHand = viewmodel:WaitForChild("RightHand")
local RightLowerArm = viewmodel:WaitForChild("RightLowerArm")
local RightUpperArm = viewmodel:WaitForChild("RightUpperArm")

local Rpp = RootPart.Position
local LA = LeftUpperArm.Position
local RA = RightUpperArm.Position

local LArmOffset = Vector3.new(
	Rpp.X - LA.X,
	-(Rpp.Y - LA.Y),
	Rpp.Z - LA.Z
)

local RArmOffset = Vector3.new(
	Rpp.X - RA.X,
	-(Rpp.Y - RA.Y),
	Rpp.Z - RA.Z
)

local Rshoulder = RightUpperArm:FindFirstChild("RightShoulder")
local Lshoulder = LeftUpperArm:FindFirstChild("LeftShoulder")
Rshoulder.Part0 = RootPart
Lshoulder.Part0 = RootPart
Rshoulder.C0 = CFrame.new(RArmOffset)
Lshoulder.C0 = CFrame.new(LArmOffset)
Rshoulder.C1 = CFrame.new(0,0,0)
Lshoulder.C1 = CFrame.new(0,0,0)

local Motor3 = Instance.new("Motor6D")
Motor3.Parent = RootPart
Motor3.Part0 = RootPart
Motor3.Part1 = CameraPart
Humanoid.Parent = viewmodel

task.wait(4)

for i, v in ipairs(viewmodel:GetChildren()) do
	local Name = v.Name:lower()
	if not string.find(Name, "root") and v:IsA("MeshPart") then
		v.Anchored = false
	end
end

(edit)
By switching the offsets which each other it somehow fixxed it, not sure how though

If you’ve fixed it please mark your post as the solution so we don’t all try to read through it to help if you don’t need it.
Also if other developers have the same issue and see your post as solved it can help them!

mean, a few things
I cant really mark the main post as a solution, i was dumb and editted it instead of responding with the solution.

Also wanted to still get some sort of answer why the i needed to change the offsets with each other to keep the arms the same

Is it the Offsets, or the Orientation of the Offsets that are the issue?
Somewhere in the model(s) did you switch the names of the items you reference in the script?

I have no clue, i dont think anythings wrong with the orientation, as its never been changed. But for some reason i must’ve changed something as the offsets worked completely fine before

(self edit)
decided to do a little more investigating before i posted this to not look as dumb.
i believe its that before i had Part0 be the Limb, not the rootpart and since i moved over to using the motors that were already in the limbs, the Part0’s were already set to the limbs so i just set rootpart to Part0

going to do a little more testing, if this was why then ill mark this as the solution.

1 Like

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