Hey there, developers!
I want to know, how do you save Part’s names and their positions,
I have tried converting it to a string then converting it to a number, but that was unsuccessfull.
Here are my scripts:
Saver:
local ds = game:GetService("DataStoreService"):GetDataStore("Build")
game.Players.PlayerRemoving:Connect(function(player)
for i,v in pairs(workspace.BlocksPlaced:GetChildren()) do
if v.Name == "PlacedBlock" then
local name = tostring(v:GetAttribute("Name"))
local async = ds:GetAsync(player.UserId)
local pos = tostring(v.Position)
table.insert(async, {name, pos})
ds:SetAsync(player.UserId, async)
end
end
end)
Loader:
local ds = game:GetService("DataStoreService"):GetDataStore("Build")
game.Players.PlayerAdded:Connect(function(player)
local async = ds:GetAsync(player.UserId)
if async then
for i,v in pairs(async) do
print(tonumber(async[v]))
print(tonumber(async[v][1]))
print(tonumber(async[v][2]))
local blockFound = game.ServerStorage.Models:FindFirstChild(tonumber(async[v][1]))
local clone = blockFound:Clone()
clone.Position = Vector3.new(tonumber(async[v][2]))
end
end
end)
I am not good at Build Modes, so any help is appreciated.
(i am going offline so i won’t be able to respond but i can after school tomorrow!)