Help me with datastore

im having a issue with datastore save im a beginner in datastore scripts
the issue im having that i cant add more value example:datastorenew = oldvalue.Money +NewValue.Text i got the script
AddRobux.OnServerEvent:Connect(function(player, textboxrobux,text)

local AcountSearch = DataStore2:GetAsync(text)
local NewValue = AcountSearch.Robux + textboxrobux
    DataStore2:SetAsync(AcountSearch,NewValue)
    print(AcountSearch.Robux)
    end) 

its give the same value if some could help me ill be happy

First, make sure the “text” in AccountSearch is player UserId
Second,AccountSearch.Robux is nil value because u didn’t add the variables of Robux in the data.
So you might change the NewValue code to :

local NewValue = {Robux = AcountSearch.Robux + textboxrobux}

Let me know if its working or not.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.