-- Turns the imported "Scene" models (one MeshPart per material) into the Decor templates of the crafted items, -- replacing the old part-built versions. Pivot = Base at (0, 0.1, 0) like the other Decor items, front = +Z. local D = game.ReplicatedStorage.OrnamentMachine.Decor local C, M = Color3.fromHex, Enum.Material local LOOK = { Red = { "d62828" }, White = { "f4f4f4" }, Gold = { "f2b733", M.Foil }, Snow = { "f7fbff" }, Green = { "2f9a43" }, DarkGreen = { "1d6a33" }, Black = { "1b1b1f" }, Orange = { "ff7a1a" }, Brown = { "9b6237" }, LightBrown = { "d9a77a" }, DarkBrown = { "4b2c18" }, Ginger = { "b8743c" }, Icing = { "fffaf2" }, Window = { "ffc94d", M.Neon }, Skin = { "f4c9a6" }, Pink = { "f08a96" }, DarkRed = { "8f1620" }, Beige = { "e8d3a8" }, Ice = { "b9e2ff", M.Glass, 0.15 }, IceRoof = { "5f8ee8" }, Glass = { "eef8ff", M.Glass, 0.75 }, Purple = { "8a4ad8" }, Yellow = { "ffd23f" }, Blue = { "3a86ff" }, } -- which model is which: a material only it has, target height in studs local ID = { { "IceRoof", "FrozenCastle", 10 }, { "Glass", "GiantSnowGlobe", 6.5 }, { "Skin", "NutcrackerGuard", 8.5 }, { "Beige", "GiftPile", 5 }, { "Purple", "GingerbreadHouse", 8 }, { "DarkRed", "SantaSleigh", 5 }, { "LightBrown", "ReindeerStatue", 7 }, { "Orange", "FrostySnowman", 9 }, { "Window", "IceLanternPost", 9 }, { "Gold", "CandyCaneArch", 9 }, } local scenes = {} for _, m in workspace:GetChildren() do if m:IsA("Model") and m.Name == "Scene" then table.insert(scenes, m) end end local done, used = {}, {} for _, rule in ID do local key, name, height = rule[1], rule[2], rule[3] local src for _, s in scenes do if not used[s] and s:FindFirstChild(key, true) then src = s; break end end if not src then table.insert(done, name .. ": NOT FOUND"); continue end used[src] = true local m = Instance.new("Model"); m.Name = name for _, p in src:GetDescendants() do if p:IsA("MeshPart") then local look = LOOK[p.Name] or { "ffffff" } for _, c in p:GetChildren() do if c:IsA("SurfaceAppearance") then c:Destroy() end end p.TextureID = "" p.Color, p.Material, p.Transparency = C(look[1]), look[2] or M.SmoothPlastic, look[3] or 0 p.Anchored, p.CanCollide, p.CastShadow = true, p.Size.Magnitude > 1, p.Name ~= "Glass" p.CollisionFidelity = Enum.CollisionFidelity.Hull if p.Name == "Window" then local l = Instance.new("PointLight"); l.Color = Color3.fromRGB(255, 205, 130); l.Range = 12; l.Brightness = 1.3; l.Parent = p end p.Parent = m end end -- front (Blender -Y) should face +Z: the snowman's nose / the house door decide; turn round if needed local cf, size = m:GetBoundingBox() local bottom = CFrame.new(cf.Position.X, cf.Position.Y - size.Y / 2, cf.Position.Z) m.WorldPivot = bottom m:ScaleTo(height / size.Y) m:PivotTo(CFrame.new(0, 0, 0)) local probe = m:FindFirstChild("Orange") or m:FindFirstChild("Window") or m:FindFirstChild("Skin") if probe and probe.Position.Z < 0 then m:PivotTo(CFrame.Angles(0, math.pi, 0)) end cf, size = m:GetBoundingBox() local base = Instance.new("Part"); base.Name = "Base" base.Size = Vector3.new(size.X, 0.2, size.Z); base.CFrame = CFrame.new(cf.Position.X, 0.1, cf.Position.Z) base.Transparency, base.CanCollide, base.Anchored = 1, false, true base.Parent = m; m.PrimaryPart = base m:PivotTo(CFrame.new(0, 0.1, 0)) local old = D:FindFirstChild(name); if old then old:Destroy() end m.Parent = D src:Destroy() table.insert(done, string.format("%s %.1fx%.1fx%.1f", name, size.X, size.Y, size.Z)) end return table.concat(done, "\n")