#DataStore

2 messages · Page 1 of 1 (latest)

visual iris
#

I made a DataStoreSystem and i wanna make it so that when a IntValueChanges it Saves it as a Data but is this Acctually usefull or should i just save the Data when the Players leaves since it sometimes sends too many requests

game.ReplicatedStorage.IntValues.MoneyValue.Changed:Connect(function()
    if MoneyValueDataStore:GetAsync(NewPlayer.UserId) then
        MoneyValueDataStore:SetAsync(NewPlayer.UserId, game.ReplicatedStorage.IntValues.MoneyValue.Value)
        MoneyValue.Value = game.ReplicatedStorage.IntValues.MoneyValue.Value
    end
end)
grim vapor
#

Only save when players leave, on game:BindToClose() (When server closes) and maybe every 1 minute to avoid data lose if the player lose his connection