diff --git a/src/runner/instance.rs b/src/runner/instance.rs index 7a3a5af..06355f9 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -251,10 +251,18 @@ impl Instance{ let dereferent:Dereferent=mlua::AnyUserDataExt::get(&this,"Referent")?; dom_mut(lua,|dom|{ let instance=dereferent.get(dom)?; - match instance.properties.get(index_str){ + //Find existing property + match instance.properties.get(index_str) + //Find default value + .or_else(||{ + let db=rbx_reflection_database::get(); + db.classes.get(instance.class.as_str()).and_then(|cd| + db.find_default_property(cd,index_str) + ) + }) + { Some(&rbx_types::Variant::CFrame(cf))=>return Ok(Into::::into(cf).into_lua(lua)), Some(&rbx_types::Variant::Vector3(v))=>return Ok(Into::::into(v).into_lua(lua)), - //None=>get_default_value _=>(), } //find a child with a matching name