Hi there! I'm trying to get my game to save the player data of how many wins the player has when they leave. The problem is, it pops up with an error: Unable to cast value to function
. I don't know what's wrong. Here is the code:
game.Players.PlayerRemoving:Connect(function(Player) DataStore:UpdateAsync(Player.UserId, Player.leaderstats.Wins.Value) end)
I used to use DataStore:SetAsync
, but it didn't work, so I switched it to UpdateAsync
. If someone could help, that would be greatly appreciated! Thanks!