print("Hello world!") task.synchronize() local ReplicatedStorage = game:GetService("ReplicatedStorage") local Shared = ReplicatedStorage:WaitForChild("Shared") local ModsFolder = ReplicatedStorage:WaitForChild("Mods") local PlacementManager = require(Shared.PlacementManager) local TG = require("./ServerChunkManager/TerrainGen") do local workspaceModFolder = game:GetService("Workspace"):WaitForChild("mods") for _,v in pairs(workspaceModFolder:GetChildren()) do v.Parent = ModsFolder end workspaceModFolder:Destroy() end local ML = require(Shared.ModLoader) ML.loadModsS() do local bv = Instance.new("BoolValue") bv.Name = "MLLoaded" bv.Value = true bv.Parent = ReplicatedStorage:WaitForChild("Objects") end local MAX_CHUNK_DIST = 200 local FakeChunk = TG:GetFakeChunk(-5,-5,-5) task.synchronize() ReplicatedStorage.Tick.OnServerEvent:Connect(function(player: Player, v: string) if TG.ServerChunkCache[v] then pcall(function() TG.ServerChunkCache[v].inhabitedTime = tick() end) end end) ReplicatedStorage.RecieveChunkPacket.OnServerInvoke = function(plr: Player, x: number, y: number, z: number) -- validate xyz type and limit if typeof(x) ~= "number" or typeof(y) ~= "number" or typeof(z) ~= "number" then return {} end if math.abs(x) > MAX_CHUNK_DIST or math.abs(y) > MAX_CHUNK_DIST or math.abs(z) > MAX_CHUNK_DIST then return FakeChunk.data end task.desynchronize() local chunk = TG:GetChunk(x, y, z) local chunkdata = chunk.data task.synchronize() return chunkdata end local tickRemote = ReplicatedStorage.Tick local function propogate(a, cx, cy, cz, x, y, z, bd) tickRemote:FireAllClients(a, cx, cy, cz, x, y, z, bd) end ReplicatedStorage.PlaceBlock.OnServerEvent:Connect(function(player, cx, cy, cz, x, y, z, blockData) --print("place",player, cx, cy, cz, x, y, z, blockData) if typeof(cx) ~= "number" or typeof(cy) ~= "number" or typeof(cz) ~= "number" then return end if typeof(x) ~= "number" or typeof(y) ~= "number" or typeof(z) ~= "number" then return end if math.abs(cx) > MAX_CHUNK_DIST or math.abs(cy) > MAX_CHUNK_DIST or math.abs(cz) > MAX_CHUNK_DIST then --return end --local chunk = TG:GetChunk(cx, cy, cz) --PlacementManager:PlaceBlockLocal(cx, cy, cz, x, y, z, blockData) propogate("B_C", cx, cy, cz, x, y, z, blockData) end) ReplicatedStorage.BreakBlock.OnServerEvent:Connect(function(player, cx, cy, cz, x, y, z) --print("del",player, cx, cy, cz, x, y, z) if typeof(cx) ~= "number" or typeof(cy) ~= "number" or typeof(cz) ~= "number" then return end if typeof(x) ~= "number" or typeof(y) ~= "number" or typeof(z) ~= "number" then return end if math.abs(cx) > MAX_CHUNK_DIST or math.abs(cy) > MAX_CHUNK_DIST or math.abs(cz) > MAX_CHUNK_DIST then return end --local chunk = TG:GetChunk(cx, cy, cz) --PlacementManager:BreakBlockLocal(cx, cy, cz, x, y, z) propogate("B_D", cx, cy, cz, x, y, z, 0) end) task.desynchronize()