I am trying to clone the models within a Master model (CookieSheets) that has an assigned base for a unique player. The code keeps failing at line 13. I can't seem to figure it out.
Here is the error: GetPrimaryPartCFrame is not a valid member of ObjectValue
local DSa = game:GetService('DataStoreService')
game.Players.PlayerAdded:connect(function(player)
wait(0.2)
local key = "user_" .. player.UserId
local DS = DSa:GetDataStore(tostring(key))
local stable = {};
print("Yesssss!2")
local char = player.Character
local list = game.Workspace.CookieSheets["CookieSheet"..player.Name]:GetChildren()
print("Found!2")
for i=1,#list do
stable[i] = {list[i].Name,{list[i]:GetPrimaryPartCFrame():components()}};
end;
DS:SetAsync('Build', stable);
end)
game.Players.PlayerRemoving:connect(function(player)
local key = "user_" .. player.userId
local DS = DSa:GetDataStore(tostring(key))
local stable = DS:GetAsync('Build')
local ModelsContainer = Instance.new("Folder",player)
ModelsContainer.Name = "ModelHolder"
for i=1,#stable do
local nm = ModelsContainer[stable[i][1]]:Clone();
nm.Parent = workspace;
nm.CFrame = CFrame.new(unpack(stable[i][2]))
end;
end)
