local function load(player: Player)
local key = player.UserId
local success, err
local data
repeat
success, err = pcall(function()
data = datastore:GetAsync(key)
end)
until success or not players:FindFirstChild(player.Name)
if not data then return end
if success then
for i, obj in ipairs(data) do
for i ,v in ipairs(datastore:GetAsync(player.UserId.."Values")) do
print(v[1])
local newPart = Instance.new("Part")
newPart.Name = obj[1]
newPart.Size = Vector3.new(obj[2],obj[3],obj[4])
newPart.Parent = workspace.BaseInfo.Base1
newPart.CFrame = CFrame.new(obj[5],obj[6],obj[7])
end
end
else
print("fail", err)
end
script.Parent.Parent.SurfaceGui.Status.Text = "Claimed by:"..player.Name
player.HasBase.Value = true
player.LastBase.Value = 1
end
local DataStoreS = game:GetService("DataStoreService")
local datastore = DataStoreS:GetDataStore("TestSave1")
local players = game:GetService("Players")
local function load(player: Player)
local key = player.UserId
local success, err
local data
repeat
success, err = pcall(function()
data = datastore:GetAsync(key)
end)
until success or not players:FindFirstChild(player.Name)
if not data then return end
if success then
for i, obj in ipairs(data) do
for i ,v in ipairs(datastore:GetAsync(player.UserId.."Values")) do
print(v[1])
local newPart = Instance.new("Part")
newPart.Name = obj[1]
newPart.Size = Vector3.new(obj[2],obj[3],obj[4])
newPart.Parent = workspace.BaseInfo.Base1
newPart.CFrame = CFrame.new(obj[5],obj[6],obj[7])
end
end
else
print("fail", err)
end
script.Parent.Parent.SurfaceGui.Status.Text = "Claimed by:"..player.Name
player.HasBase.Value = true
player.LastBase.Value = 1
end
script.Parent.MouseClick:Connect(load)
Well I saw a tutorial on data stores on youtube, I copied a few stuff from there, however, I’ve read datastore many times in the past. Im not sure how to get my parts to spawn in any other way.
Can you send the code on how youre saving the data? The error that you named the post with means you tried to do something like this: local string = workspace.Part.."hi"