This script only saves one effect

How do I make it save 3 effects
local DataStoreService = game:GetService(“DataStoreService”)
local DataStore = DataStoreService:GetDataStore(“EffectsItems2”)
local replicatedStorage = game:GetService(“ReplicatedStorage”)

game.Players.PlayerAdded:Connect(function(player)
local eggsFolder = Instance.new("Folder")
eggsFolder.Name = "Effects"
eggsFolder.Parent = player

local data
local success, errorMsg = pcall(function()
	data =  DataStore:GetAsync("EffectsData-".. player.UserId)
end)

if success and data then
	for _, EffectName in pairs(data) do
		if replicatedStorage.Particles:FindFirstChild(EffectName) then
			local effectValue = Instance.new("BoolValue")
			effectValue.Name = EffectName
			effectValue.Parent = eggsFolder
		end
	end
end

end)

game.Players.PlayerRemoving:Connect(function(player)

local effectsTable = {}

for _, effect in pairs(player.Effects:GetChildren()) do
	table.insert(effectsTable, effect.Name)
	print(effect.Name)
end
local success, errorMsg = pcall(function()
	DataStore:SetAsync("EffectsData-".. player.UserId, effectsTable)
end)

print("test")

if success then
	print("Saved")
else
	print(errorMsg)
end
end)

game:BindToClose(function()
for _, player in pairs(game.Players:GetPlayers()) do
	local effectsTable = {}
	
	for _, effect in pairs(player.Effects:GetChildren()) do
		table.insert(effectsTable,effect.Name)
		print(effect.Name)
		
	end
	local success, errorMsg = pcall(function()
		DataStore:SetAsync("EffectsData-"..player.UserId, effectsTable)
	end)
	if success then print("Saved on BTC for "..player.Name) end
end
end)

Is it printing the Player’s Effects when you call through its children?

nope it isn’t printing out the effects. In fact it says the folder “Effects” isnt part of “players.Sufganiyot” even though when I play the folder is exactly like that. But even then, it only saves one effect.

O k a y

Where is the script located? And what type is it?

the script is a server script located in ServerScriptService.

Try printing player.Effects before you get the children of the Effects folder?