Data store won't work, and numbers only show up changing for one player!

The next nil value comes from here:

game.Players.PlayerRemoving:Connect(function(plr)
	local Data = {
		CatFood = plr.leaderstats.CatFood.Value,
		XP = plr.leaderstats.XP.Value,
		Coconuts = plr.leaderstats.Coconuts.Value,
		Seashells = plr.leaderstats.Seashells.Value,
	}
	local PlayerID = "Player_"..plr.UserId
	local success, err = pcall(function()
		DataStore:SetAsync(PlayerID,Data)
	end)
end)
DataStore:SetAsync(PlayerID,Data)

The script doesn’t know what DataStore is since it’s mentioned in the playeradded function

Then define DataStore variable again with the same key.

I keep getting this error ServerScriptService.DataStoreScript:27: attempt to call a nil value - Server - DataStoreScript:27

If you could, send the script you are using currently.

I found out why the leaderstats weren’t working. Thank you for helping!