Basically I made a save program. Whenever it's supposed to save and execute success, it executed the error warning. Please help!
local DataStoreService = game:GetService("DataStoreService") local PlayerData = DataStoreService:GetDataStore("PlayerData") local X = 0 game.Players.PlayerAdded:Connect(function(plr) local SpendingCoins = script.Parent.Parent.Workspace.Players:WaitForChild(""..plr.DisplayName).SpendingCoins local UserID = "Player"..plr.UserId local data = UserID:GetAsync(UserID) if data then SpendingCoins.Value = data else SpendingCoins.Value = 0 end end) game.Players.PlayerRemoving:Connect(function(plr) local Success, Errors = pcall(function() local Name = plr.DisplayName local SpendingCoins = game.Workspace.Players:FindFirstChild(""..Name).SpendingCoins local UserID = "Player"..plr.UserId PlayerData:SetAsync(UserID, SpendingCoins.Value) end) if not Success then warn("Connection Error, Try Again") end end)
Please help if you can. Thanks in advance!