How to use datastores to ban people?

Hello i need help with datastores to ban people

i checked this post before i made my datastore:

i tried to do this script but when i fired the remote it always returned couldnt ban idk why

local DSS = game:GetService("DataStoreService")
local DS = DSS:GetDataStore("BanStore")

function saveBanData(plr)
	
	local BanData = {}
	
	local success, err = pcall(function()
		DS:SetAsync(plr.UserId, BanData)
	end)
	
	if success then
		print("banned")
	elseif err then
		print("couldnt ban")
	end
end

function banfunction(plr)
	plr:Kick()
	saveBanData()
end

game.Players.PlayerAdded:Connect(function(plr)
	local data
	local success, err = pcall(function()
		data = DS:GetAsync(plr.UserId)
	end)
	if success and data then
		plr:Kick()
		return
	else
		return
	end
end)

game.ReplicatedStorage.BanRemote.OnServerEvent:Connect(banfunction)

Call saveBanData() before kicking the player.
You’re also not passing any value to saveBanData() while plr is expected.

If you made use of err value (2nd return value of pcall) you could have figured it out.

thank you for solution it worked