Would kicking the player work?

Hello! I am making a simulator so I am adding a lot of reinforcing their data. I’ve experiencing many data wipes so I implemented a rudimentary system that hopefully saves their data once they leave or joins. The data wipes stopped (I think) once I added the autosave however, I would like to know if the kicking the player would work.

local ds = game:GetService("DataStoreService")

local MoneyData = ds:GetDataStore("Money Store") -- Databases
local WinData = ds:GetDataStore("Wins Store") -- Databases
local MPData = ds:GetDataStore("MP Store") -- Databases

local rs = game:GetService("ReplicatedStorage")
local AutoEvent = rs:WaitForChild("AutoSave")
local player = game.Players

local Data_FAILED = {}

player.PlayerAdded:Connect(function(plr)
	

	
	local MoneyKey = ""..plr.UserId.."- Money" -- Special Data Key
	local WinKey = ""..plr.UserId.."- Wins" -- Special Data Key
	local MPKey = ""..plr.UserId.."- Money MP" -- Special Data Key
	
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = plr
	
	local Money = Instance.new("NumberValue") -- Number Value because you could have decimals in it instead of IntValue
	Money.Name = "💰 Money"
	Money.Value = 0
	Money.Parent = leaderstats
	
	local Wins = Instance.new("NumberValue") -- Number Value because you could have decimals in it instead of IntValue
	Wins.Name = "🏆 Wins"
	Wins.Value = 0
	Wins.Parent = leaderstats
	
	-- [Configs] --
	local MoneyConfig = Instance.new("Configuration")
	MoneyConfig.Name = "MoneyConfig"
	MoneyConfig.Parent = plr
	
	local MP = Instance.new("NumberValue")  -- This "MP" is the money multiplier each win you get
	MP.Name = "MoneyMP"
	MP.Value = 1
	MP.Parent = MoneyConfig
	
	local Data_Money
	local Data_Wins
	local Data_MP
	
	local success, errormsg = pcall(function()
		Data_Money = MoneyData:GetAsync(MoneyKey) -- Gets their data
		Data_Wins = WinData:GetAsync(WinKey) -- Gets their data
		Data_MP = MPData:GetAsync(MPKey) -- Gets their data
	end)
	if success then
		
	plr.leaderstats["💰 Money"].Value = Data_Money  -- Loads their date if success
	plr.leaderstats["🏆 Wins"].Value = Data_Wins  -- Loads their date if success
	plr.MoneyConfig.MoneyMP.Value = Data_MP  -- Loads their date if success
	
		print("Success")
	end
	
	if errormsg  then
		table.insert(Data_FAILED, plr)
		plr:Kick("Data didn't load, please rejoin again!")
		warn(errormsg)
		
	end
	
	wait(.3)
	MP.Value = math.round(.2 * plr.leaderstats["🏆 Wins"].Value) 
	print("MP UPDATED")
	
	local AutoSave = coroutine.create(function() -- Thread (Autosaves their data)
		MoneyData:SetAsync(MoneyKey, plr.leaderstats["💰 Money"].Value)
		WinData:SetAsync(WinKey, plr.leaderstats["🏆 Wins"].Value)
		MPData:SetAsync(MPKey, plr.MoneyConfig.MoneyMP.Value)
		
		AutoEvent:FireClient(plr)
	end)
	
	
	while task.wait(30) do
		coroutine.resume(AutoSave) -- Resume means restart in coroutines so I restart it each 30 secs
		print(plr.Name.." - Data Saved; Money: "..plr.leaderstats["💰 Money"].Value..", MP: "..plr.MoneyConfig.MoneyMP.Value..", and Wins: "..plr.leaderstats["🏆 Wins"].Value.."!")
	end
	
end)

player.PlayerRemoving:Connect(function(plr)
	local MoneyKey = ""..plr.UserId.."- Money"
	local WinKey = ""..plr.UserId.."- Wins"
	local MPKey = ""..plr.UserId.."- Money MP"
	
	local success, errormsg = pcall(function()
		
		MoneyData:SetAsync(MoneyKey, plr.leaderstats["💰 Money"].Value)
		WinData:SetAsync(WinKey, plr.leaderstats["🏆 Wins"].Value)
		MPData:SetAsync(MPKey, plr.MoneyConfig.MoneyMP.Value)
		print(plr.Name.." Has Left - Data Saved; Money: "..plr.leaderstats["💰 Money"].Value..", MP: "..plr.MoneyConfig.MoneyMP.Value..", and Wins: "..plr.leaderstats["🏆 Wins"].Value.."! UserID: "..plr.UserId)
	end)
	
end)

game:BindToClose(function(p)
	for i, playr in pairs(player:GetPlayers()) do
		local ID = "_Player"..playr.UserId
		
		local success, errormsg = pcall(function()
			MoneyData:SetAsync(ID, p.leaderstats["💰 Money"].Value)
			WinData:SetAsync(ID, p.leaderstats["🏆 Wins"].Value)
			MPData:SetAsync(ID, p.MoneyConfig.MoneyMP.Value)
			print(playr.Name.." Has Left - Data Saved; Money, MP, and Wins!  UserID: "..playr.UserId)
		end)
	end
	
end)

I haven’t received any answers whatsoever.

player:Kick will trigger the PlayerRemoving event. It’s hard to discern what your original question is.

Your autosave while loop should check if the player is still logged in and valid or you may be writing bad data

I want to see if there’s an error or couldn’t load their, it would kick the player out, and not overwrite their data with values that are 0 so I added a table and want to see if it would work