I’m working on a script that converts an R6 character to R15 character. Currently, when attempting to spawn as the converted R15 (from R6) I get this:
https://gyazo.com/788c30d578ad264835beb23f4bd2762e
Recently I have fixed an issue that the head was not attached, so I assumed it was that, but it appears not.
Here is the R6 - R15 conversion code.
function r6Convert(rig, name) --convert r6 to r15
local character = Instance.new("Model")
character.Name = name
character.Parent = workspace
local hats = Instance.new("Model")
hats.Name = "CharacterHats"
hats.Parent = game.ServerStorage["Character Converter Storage"]
local head = Instance.new("Part")
head.Parent = game.ServerStorage["Character Converter Storage"]
head.Size = Vector3.new(2, 1, 1)
head.Shape = Enum.PartType.Block
head.Name = "Head"
local R15 = script:FindFirstChild("R15"):Clone()
R15.Parent = game.ServerStorage["Character Converter Storage"]
R15.Name = "R15RIG"
local r15head
for i = 1, #rig do
local child = rig[i]:Clone()
child.Parent = character
end
for i = 1, #rig do
local part = rig[i]
if(part.Name == "Head") then
head.Color = part.Color
elseif(part.Name == "Left Leg") then
R15:FindFirstChild("LeftUpperLeg").Color = part.Color
R15:FindFirstChild("LeftLowerLeg").Color = part.Color
R15:FindFirstChild("LeftFoot").Color = part.Color
elseif(part.Name == "Left Arm") then
R15:FindFirstChild("LeftUpperArm").Color = part.Color
R15:FindFirstChild("LeftLowerArm").Color = part.Color
R15:FindFirstChild("LeftHand").Color = part.Color
elseif(part.Name == "Right Leg") then
R15:FindFirstChild("RightUpperLeg").Color = part.Color
R15:FindFirstChild("RightLowerLeg").Color = part.Color
R15:FindFirstChild("RightFoot").Color = part.Color
elseif(part.Name == "Right Arm") then
R15:FindFirstChild("RightUpperArm").Color = part.Color
R15:FindFirstChild("RightLowerArm").Color = part.Color
R15:FindFirstChild("RightHand").Color = part.Color
elseif(part.Name == "Torso") then
R15:FindFirstChild("UpperTorso").Color = part.Color
R15:FindFirstChild("LowerTorso").Color = part.Color
else
end
end
local rigHead = character:FindFirstChild("Head"):Clone()
local headChildren = rigHead:GetChildren()
for i = 1, #headChildren do
local item = headChildren[i]
item.Parent = head
end
for i = 1, #R6BodyParts do
local part = character:FindFirstChildWhichIsA("BasePart")
part:Remove()
end
for i = 1, #R15BodyParts do
local part = R15:FindFirstChildWhichIsA("BasePart")
part.Parent = character
end
local charChildren = character:GetChildren()
for i = 1, #charChildren do
local item = charChildren[i]
if(item.ClassName == "Accessory") then
item.Parent = hats
elseif(item.ClassName == "Shirt") then
item.Parent = character
elseif(item.ClassName == "Pants") then
item.Parent = character
elseif(item.ClassName == "ShirtGraphic") then
item.Parent = character
else
end
end
local oldHead = character:FindFirstChild("Head")
local headLocation = oldHead.Position
oldHead:Remove()
head.Parent = character
head.Position = headLocation
local humanoid = character:WaitForChild("Humanoid")
local hatsChildren = hats:GetChildren()
for i = 1, #hatsChildren do
local item = hatsChildren[i]:Clone()
humanoid:AddAccessory(item)
end
humanoid.RigType = Enum.HumanoidRigType.R15
local camera = workspace.CurrentCamera or Instance.new("Camera", workspace)
character:MoveTo((camera.CFrame + (camera.CFrame.lookVector*15)).p)
game.Selection:Set({character})
print("Conversion complete")
R15:Remove()
hats:Remove()
end
Does anyone have any ideas?
If you could help that would be great!