So recently I have been working with datastores where when a player leaves the game the data will be stored in a datastore
There is like 5 datastores that will get sent when your local player leaves which can mess up with needed data for your game this code below is example what gets sent when you leave the game:
game.Players.PlayerRemoving:connect(function(Player)
if Player:FindFirstChild("RocketData") then
local RocketData = Player:WaitForChild("RocketData")
local Data = {}
for i, v in pairs(RocketData:GetChildren()) do
Data[v.Name] = v.Value
end
local Success, Error = pcall(function()
BombData:SetAsync(Player.UserId, Data)
end)
end
end)