Untitled

mail@pastecode.io avatar
unknown
lua
a month ago
1.8 kB
6
Indexable
Never
```lua
local function SaveProps(player, SaveType)
    local PropAray = CollectService:GetTagged(player.Name .. "Props")
    if PropAray and PropAray ~= nil then
        local CurrentChunk = 1
        local Count = 0
        local CurrentChunkCount = 0
        for _, Prop in ipairs(PropAray) do
            Count = Count+1
            local Pivot = LocationStore.Add(Prop)
            local PropName = Prop.Name
            if CurrentChunkCount <= CHUNK_SIZE then
                Compiler.add(Count .. "Name", PropName, player.Name .. "SavingCompiledData")
                Compiler.add(Count .. "Pivot", Pivot, player.Name .. "SavingCompiledData")
                CurrentChunkCount = CurrentChunkCount+1
                
            else
                local BuiltText = Compiler.Build(player.Name .. "SavingCompiledData")
                playerstore.storeDS(player, "Chunk" .. CurrentChunk, BuiltText, "PlayerBuildData")
                Compiler.Scrub(player.Name .. "SavingCompiledData")
                
                CurrentChunk = CurrentChunk+1 
                CurrentChunkCount = 1
                Count = 1

                Compiler.add(Count .. "Name", PropName, player.Name .. "SavingCompiledData")
                Compiler.add(Count .. "Pivot", Pivot, player.Name .. "SavingCompiledData")
            end
        end
        if Compiler.Build(player.Name .. "SavingCompiledData") ~= nil then
            local BuiltText = Compiler.Build(player.Name .. "SavingCompiledData")
            playerstore.storeDS(player, "Chunk" .. CurrentChunk, BuiltText, "PlayerBuildData")
            Compiler.Scrub(player.Name .. "SavingCompiledData")
        end
        Compiler.add("FinalChunkCount", CurrentChunkCount, "FinalSaveData")
    end
end
```
Leave a Comment