a question about Roblox studio, or rather, about dataStore. If you save the values directly in the script by the pointsStore:SetAsync ("Mars", 19) when outputting data:GetCurrentPage() - this value is output, but if you do this via a function, the value is saved, but does not appear when the data:GetCurrentPage(). How can I save user data?
save the values directly in the script:
PlayerPoints:SetAsync("Mars", 19)
local success, err = pcall(function()
local Data = PlayerPoints:GetSortedAsync(false, 5)
local WinsPage = Data:GetCurrentPage()
print(WinsPage)
end)
save the values directly in the function:
local function givePointsPlayer(player, points)
local pointsOld = pointsStore:GetAsync(player.Name.."&"..tostring(player.UserId).."&"..tostring(os.date("*t").month))
if (pointsOld == nil) then
pointsOld = 0
end
print(pointsOld)
local success, err = pcall(function()
pointsStore:SetAsync(
player.Name.."&"..tostring(player.UserId).."&"..tostring(os.date("*t").month),
pointsOld + points
)
end)
end
EventEditPointsPlayer.OnServerEvent:Connect( function(player, points)
givePointsPlayer(player, points)
end)
answer: answer
how do I need to save user data so that it is output via :GetCurrentPage() ??