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

DataStore script printing data is nil, why?

Asked by
steelflix -12
4 years ago
local datastore = game:GetService("DataStoreService")

game.Players.PlayerRemoving:Connect(function(player)
    local datastore2 = datastore:GetDataStore(player.UserId .. "Dialog2")
    local Dialog = workspace.Dialog
    datastore2:SetAsync("Dialog2", Dialog.Value)
end)


game.Players.PlayerAdded:Connect(function(player)
    local datastore2 = datastore:GetDataStore(player.UserId .. "Dialog2")
    print(datastore2:GetAsync("Dialog2"))
end)

Answer this question