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

How to fix datastore script that isn't running last two lines of code?

Asked by
Meqolo 78
6 years ago

For some reason the last 2 lines of code inside the :PlayerRemoving() aren't running. I'm currently trying to use a table inside of the datastore, so I don't have to use single datastores.

game.Players.PlayerRemoving:Connect(function(plr)
    local money = game.Players[tostring(plr.Name)].leaderstats.Money.Value
    local Stats = game:GetService("ReplicatedStorage").Stats[plr.Name].HeadsCaptured
    local Heads = {
        Flumpy = Stats.Flumpy.Value,
        Germany = Stats.Germany.Value,
        Ice = Stats.Ice.Value,
        Lava = Stats.Lava.Value,
        Meqolo = Stats.Meqolo.Value,
        Snow = Stats.Snow.Value,
        UK = Stats.UK.Value,
        USA = Stats.USA.Value
    }

    Money:SetAsync(plr.UserId, money)
    print("a")
    Heads:SetAsync(plr.UserId, {Stats.Flumpy.Value,Stats.Germany.Value,Stats.Ice.Value,Stats.Lava.Value,Stats.Meqolo.Value,Stats.Snow.Value,Stats.UK.Value,Stats.USA.Value})
end)

Any help is appreciated

0
Instead of having to save each value inside the table, use JSONEncode. It will format/input everything into a string, and once you do just load it with JSONDecode liteImpulse 47 — 6y
0
Can you include the rest of the script User#5423 17 — 6y
0
liteImpulse can you explain how? ive been strugglign with the same issue as meqolo PoePoeCannon 519 — 6y

Answer this question