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

SetAsync() wont run and neither will any code behind it, how to fix? [closed]

Asked by
Meqolo 78
6 years ago

I'm using a datastore to save a table, however SetAsync() and any code that comes after it just doesn't run

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 HeadStats = {
        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
    }
    print("a")
    local HeadSave = game:GetService("HttpService"):JSONEncode(HeadStats)
    print(HeadSave)
    Heads:SetAsync(plr.UserId, HeadSave)
end)

Code in question being:

Heads:SetAsync(plr.UserId, HeadSave)
print("a")

The output contains:

a
{"Ice":false,"Flumpy":false,"Lava":false,"Snow":false,"USA":false,"Germany":false,"Meqolo":false,"UK":false}
0
Your saying it doesn't run, and the print "a" after that is running? hiimgoodpack 2009 — 6y
0
No, there's a print "a" before hand works Meqolo 78 — 6y

Marked as Duplicate by User#5423 and MrNicNac

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?