Загрузка данных


local Players = game:GetService("Players")
local player = Players.LocalPlayer

print("--- ЗАПУСК КЛИЕНТА ДЛЯ", player.Name, "---")

local starterScripts = script.Parent
local clientFolder = starterScripts:WaitForChild("Client", 5)
local controllers = clientFolder and clientFolder:FindFirstChild("Controllers") or starterScripts:FindFirstChild("Controllers")

if controllers then
	for _, module in ipairs(controllers:GetChildren()) do
		if module:IsA("ModuleScript") then
			task.spawn(function()
				local success, result = pcall(require, module)
				if success then
					print("[КЛИЕНТ ОК]:", module.Name)
					if type(result) == "table" then
						if result.Init then result:Init() end
						if result.Start then result:Start() end
					end
				else
					warn("[ОШИБКА КЛИЕНТА]:", module.Name, result)
				end
			end)
		end
	end
else
	warn("Не найдена папка Controllers в StarterPlayerScripts!")
end