hi why dfos this return unable to cast value to function? if i change update to set it doesnt but for some reason updateasync retun that
local DataStore = game:GetService('DataStoreService'):GetDataStore("jojo")
function UploadData(Player)
if Player:FindFirstChild("Stats") then
local Key = Player.UserId
local Folder = Player.Stats
local SaveList = {}
for i,v in pairs(Folder:GetChildren())do
SaveList[v.Name] = v.Value
end
DataStore:UpdateAsync(Key,SaveList)
end
end
game.Players.PlayerAdded:Connect(function(player)
repeat wait() until player.Character
repeat wait() until player.Stats.FirstJoin
if player.Stats.FirstJoin.Value == true then
player.Stats.FirstJoin.Value = false
UploadData(player)
end
end)
local DSS = game:GetService("DataStoreService")
local DataStore = DSS:GetDataStore("jojo")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
local PlrStats = Player:WaitForChild("Stats")
local FirstJoin = PlrStats:WaitForChild("FirstJoin")
if FirstJoin.Value then
FirstJoin.Value = false
local Key = Player.UserId
local SaveList = {}
for _, Stat in ipairs(PlrStats:GetChildren()) do
SaveList[Stat.Name] = Stat.Value
end
DataStore:SetAsync(Key, SaveList)
end
end)