local DataStore = game:GetService("DataStoreService")
game.Players.PlayerAdded:connect(function(plr)
local player = plr
local Saves = player:WaitForChild("Saves")
local savesAmount = Saves:WaitForChild("SavesAmount")
local num = 0
local SavesAMBackup = savesAmount.Value
wait(2)
if savesAmount.Value > 0 then
repeat
local keyStore = DataStore:GetDataStore("keyStore "..num)
local CFrameData = DataStore:GetDataStore(tostring("CFrameDataStore "..num))
if keyStore ~= nil then
local key = keyStore:GetAsync(player.UserId) or false
wait()
num = num + 1
SavesAMBackup = SavesAMBackup - 1
local folder = Instance.new("Folder")
folder.Name = num
folder.Parent = player.Saves
local keyFolder = Instance.new("BoolValue")
keyFolder.Name = "key"
keyFolder.Value = key
keyFolder.Parent = folder
local PlayerPosition = Instance.new("CFrameValue")
PlayerPosition.Name = "PlayerCFrame"
PlayerPosition.Value = CFrameData
PlayerPosition.Parent = folder
else
print("datastore nil")
end
until SavesAMBackup <= 0
else
warn("no saves")
end
end)
error; Workspace.DataStore.FolderSave:35: bad argument #3 to 'Value' (CFrame expected, got Object) Very weird because CFrameData is a CFrame... I tried adding value after but that doesn't work either..K.
