Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't this save to data store?

Asked by 6 years ago

I would expect this to save to datastore when the player leaves but it doesn't.

Data = game:GetService("DataStoreService"):GetDataStore("DataForDaMoon")
local Tycoon
game.Players.PlayerRemoving:Connect(function(Player)

    local playerData = {
        Money = Player.PlayerItems.MoneyMoon.Value,
        Placed = {}
    }

    if Player.leaderstats.SandboxSlot.Value == 'Sandbox1' then
        Tycoon = workspace.TestTycoon
    end

    for i, v in pairs(Tycoon.TestItems:GetChildren()) do
        if v:IsA('Model') then
            table.insert(playerData.Placed, {Name = v.Name, X = v.PrimaryPart.CFrame.x, Y = v.PrimaryPart.CFrame.y, Z = v.PrimaryPart.CFrame.z})
        end
    end

    Data:SetAsync(Player.UserId, playerData)
end)
0
you are testing this with the roblox client and not studio, are you? fanofpixels 718 — 6y
0
im testing with studio therealae 7 — 6y

Answer this question