Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game.ReplicatedStorage.SaveBuild.OnServerEvent:Connect(function(player)
- local partTable = {}
- for i, inst in pairs(workspace:GetChildren()) do
- if inst.Name == "BuiltBlock" then
- local position = {
- X = inst.Position.X,
- Y = inst.Position.Y,
- Z = inst.Position.Z
- }
- local material = inst.Material
- local color = inst.BrickColor
- local size = inst.Size
- partTable[i] = {Position = position, Material = tostring(material), Color = tostring(color), Size = tostring(size)}
- end
- end
- local success, err = pcall(function()
- BuildsDataStore:SetAsync(player.UserId, partTable)
- end)
- if success then
- print("Saved player build.")
- elseif not success and err then
- print("Not successful: "..err)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement