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}

2 comments

0

Your saying it doesn't run, and the print "a" after that is running?

0

No, there's a print "a" before hand works