local Lighting = game:GetService("Lighting")
local StarterGui = game:GetService("StarterGui")
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local TweenService = game:GetService("TweenService")

local dayOfWeek = {"Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота", "Воскресенье"}

local JobLocation = Vector3.new(0, 500, 0) -- координаты блока Job
local SchoolLocation = Vector3.new(0, 600, 0) -- координаты блока School
local HomeLocation = Vector3.new(0, 800, 0) -- координаты блока Home
local ShopLocation = Vector3.new(0, 1000, 0) -- координаты блока Shop

local timeCycle = {
	{time = 0, speed = 1}, -- ночь
	{time = 600, speed = 8}, -- утро
	{time = 900, speed = 4}, -- день
	{time = 1800, speed = 1}, -- вечер
	{time = 2400, speed = 2} -- ночь
}

local function getDayOfWeek()
	return dayOfWeek[(math.floor(tick() / 86400) % 7) + 1]
end

local function updateTimeGui()
	local time = Lighting:GetMinutesAfterMidnight()
	local minutes = math.floor(time % 60)
	local hours = math.floor(time / 60)
end

local function updateNPCs()
	local NPCs = Workspace.Civilians:GetChildren()

	for _, NPC in ipairs(NPCs) do
		local age = NPC:FindFirstChild("Age") and NPC.Age.Value or 0
		local busy = NPC:FindFirstChild("Busy") and NPC.Busy.Value or false
		local path = Instance.new("Pathfinding")
		local partToGo

		if age < 18 then
			if busy then
				partToGo = SchoolLocation
			else
				partToGo = HomeLocation
			end
		else
			if busy then
				partToGo = JobLocation
			else
				partToGo = HomeLocation
			end
		end

		path:ComputeAsync(NPC.HumanoidRootPart.Position, partToGo)

		local waypoints = path:GetWaypoints()

		for _, waypoint in ipairs(waypoints) do
			local moveTween = TweenService:Create(NPC.HumanoidRootPart, TweenInfo.new(waypoint.Action == Enum.PathWaypointAction.Jump and 0.5 or 1), {
				CFrame = waypoint.Position
			})

			moveTween:Play()
			moveTween.Completed:Wait()
		end

		NPC.Humanoid:MoveTo(partToGo)

		if partToGo == HomeLocation or partToGo == ShopLocation then
			if busy then
				NPC.Busy.Value = false
			else
				NPC.Busy.Value = true
			end
		end
	end
end

Lighting.TimeOfDay = 0

game:GetService("RunService").Heartbeat:Connect(function()
	local time = Lighting:GetMinutesAfterMidnight()

	for i = 1, #timeCycle do
		if time >= timeCycle[i].time and time < timeCycle[i + 1].time then
			Lighting.ClockTime = i
			wait(1 / timeCycle[i].speed)
			break
		end
	end

	updateTimeGui()

	if time % 60 >= 55 then
		updateNPCs()
	end
end)

for _, player in ipairs(Players:GetPlayers()) do

	local gui = Instance.new("ScreenGui")
	gui.Name = "TimeGUI"
	gui.Parent = player.PlayerGui

	local frame = Instance.new("Frame")
	frame.Size = UDim2.new(0, 200, 0, 100)
	frame.Position = UDim2.new(0, 10, 0, 10)
	frame.BackgroundTransparency = 0.8
	frame.BackgroundColor3 = Color3.new(0, 0, 0)
	frame.BorderSizePixel = 0
	frame.Parent = gui

	local label = Instance.new("TextLabel")
	label.Size = UDim2.new(1, 0, 1, 0)
	label.Position = UDim2.new(0, 0, 0, 0)
	label.BackgroundTransparency = 1
	label.Text = ("День: "..dayOfWeek[game.Lighting.ClockTime].." Время:"..game.Lighting.ClockTime)
	label.Font = Enum.Font.SourceSansBold
	label.TextColor3 = Color3.new(1, 1, 1)
	label.TextSize = 18
	label.Parent = frame
end

Players.PlayerAdded:Connect(function(player)
	local gui = Instance.new("ScreenGui")
	gui.Name = "TimeGUI"
	gui.Parent = player.PlayerGui

	local frame = Instance.new("Frame")
	frame.Size = UDim2.new(0, 200, 0, 100)
	frame.Position = UDim2.new(0, 10, 0, 10)
	frame.BackgroundTransparency = 0.8
	frame.BackgroundColor3 = Color3.new(0, 0, 0)
	frame.BorderSizePixel = 0
	frame.Parent = gui

	local label = Instance.new("TextLabel")
	label.Size = UDim2.new(1, 0, 1, 0)
	label.Position = UDim2.new(0, 0, 0, 0)
	label.BackgroundTransparency = 1
	label.Text = ("День: "..dayOfWeek[game.Lighting.ClockTime].." Время:"..game.Lighting.ClockTime)
	label.Font = Enum.Font.SourceSansBold
	label.TextColor3 = Color3.new(1, 1, 1)
	label.TextSize = 18
	label.Parent = frame
end)

Players.PlayerRemoving:Connect(function(player)
	player.PlayerGui:FindFirstChild("TimeGUI"):Destroy()
end)

return {} сделай так чтобы время шло и чтобы у клиентов обновлялось время и день недели регулярно