> local Data = game:GetService("DataStoreService"):GetDataStore("BankNWalletDatastore")
> local Players = game:GetService("Players")
>
> Players.PlayerAdded:Connect(function(plr)
> local success, err = pcall(function()
> data = Data:GetAsync("Data_"..plr.UserId) or {}
> end)
>
> if success then
> local folder = Instance.new("Folder")
> folder.Name = 'leaderstats'
> folder.Parent = plr
> local wallet = Instance.new("IntValue")
> wallet.Name = "Wallet"
> wallet.Value = data["Wallet"] or 25000
> wallet.Parent = folder
> local bank = Instance.new("IntValue")
> bank.Name = "Bank"
> bank.Value = data["Bank"] or 0
> bank.Parent = folder
> end
> if err then
> plr:Kick("No data was found. Perhaps this was an error?")
> end
> end)
>
>
> Players.PlayerRemoving:Connect(function(plr)
> local tosave = {
> ["Bank"] = plr.leaderstats.Bank.Value,
> ["Wallet"] = plr.leaderstats.Wallet.Value
> }
> local success, err = pcall(function()
> Data:SetAsync("Data_"..plr.UserId, tosave)
> end)
> if success then
> print("Success!")
> end
> end)
Continuous flow of errors (same one)
Basically I’m trying to get rid of those errors.
Well the errors seem to happen even though there’s no SetAsync anywhere from Line 1-20 and from what I see it’s a roblox sided error possibly?
Well I tried getting help from a lot of scripting geniuses but I’m not sure how skillful they are but they couldn’t seem to fix it since SetAsync don’t occur anywhere in the script from line 1-20.
From what I see this occurs when the player joins the game? Possibly might be adding some data to the queue when it doesn’t need to be added or set.