From 7bbb9ca24f8a6a81b1ca749e93d5b1883fa016fe Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Thu, 14 Sep 2023 13:53:52 -0700
Subject: [PATCH] have to write the model ref to make a valid model file

---
 src/main.rs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/main.rs b/src/main.rs
index 0429d30..ef02c2a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -507,7 +507,12 @@ fn interactive() -> BoxResult<()>{
                     let mut dest=std::path::PathBuf::from("maps/passed");
                     dest.push(file_thing.file_name());
                     let output = std::io::BufWriter::new(std::fs::File::create(dest)?);
-                    rbx_binary::to_writer(output, &dom, &[dom.root_ref()])?;
+                    //write workspace:GetChildren()[1]
+                    let workspace_children=dom.root().children();
+                    if workspace_children.len()!=1{
+                        return Err(Error::new("there can only be one model"));
+                    }
+                    rbx_binary::to_writer(output, &dom, &[workspace_children[0]])?;
                     //move original to processed folder
                     std::path::PathBuf::from("maps/unaltered")
                 }