So I have these lines of code:
local function IncrementMoney(player)
while true do
wait(4)
local PlayerStats = DataStoreService:GetDataStore("PlayerStatsTest"):GetAsync(player.UserId)
print(PlayerStats)
PlayerStats:IncrementAsync("Money", 10)
end
end
When it hits print(PlayerStats) it prints out this:
{"DeckCount":1,"Wins":0,"Money":100,"Losses":0,"Reputation":0,"GamesPlayed":0,"LifePointsLost":0,"LifePointsDealt":0}
Yet when it goes to Increment "Money" it gives me this error: 15:48:07.950 - ServerScriptService.LoadPlayerData:181: attempt to call method 'IncrementAsync' (a nil value)

2 comments
I realize that I'm getting Datastore over and over again so I probably can move that outside of the while loop.
When I try and print Money from the datastore it also says it's a nil value so I don't know why it would do that.