Essentially, I am trying to make it so mid-game, the player's character Rig Type can change. Despite successfully allowing the type of character to change, the Accessories position is not in place. To fix this, I am saving the CFrames in a table and then retrieving them to apply it to the new character. As far as I am concerned, CFrames contain commas, which would automatically separate indexes in the table rather than saving it as one total CFrame. Is there any way I can save it as one value so I can retrieve it later?
Here is the script that saves the values:
local charNames = {}
local charCFrames = {}
for a, b in pairs(plr.Character:GetChildren()) do
if b:IsA("Accessory") then
for c, d in pairs(b:GetChildren()) do
if d:IsA("Part") then
table.insert(charNames, #charNames, b.Name)
table.insert(charCFrames, #charCFrames, d.CFrame)
end
end
end
end
Here is the script that retrieves the values:
local count = 0
for a, b in pairs(plr.Character:GetChildren()) do
if b:IsA("Accessory") then
for c, d in pairs(b:GetChildren()) do
if d:IsA("Part") then
for e, f in pairs(charNames) do
if d.Parent.Name == tostring(f) then
local newPos = charCFrames[count]
d.CFrame = newPos
print(newPos)
end
count = count +1
end
end
end
end
end
count = 0
Thank you in advance!
