diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b41006..69920e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed instances with attributes not saving if they container integer attributes - Fixed attributes not being set properly if the instance has an empty attributes property - Fixed error messages for reading & writing roblox files not containing the full error message - Fixed crash when trying to access an instance reference property that points to a destroyed instance diff --git a/packages/lib-roblox/src/instance/mod.rs b/packages/lib-roblox/src/instance/mod.rs index 3213af9..dbd58d1 100644 --- a/packages/lib-roblox/src/instance/mod.rs +++ b/packages/lib-roblox/src/instance/mod.rs @@ -516,6 +516,12 @@ impl Instance { let inst = dom .get_by_ref_mut(self.dom_ref) .expect("Failed to find instance in document"); + // NOTE: Attributes do not support integers, only floats + let value = match value { + DomValue::Int32(i) => DomValue::Float32(i as f32), + DomValue::Int64(i) => DomValue::Float64(i as f64), + value => value, + }; if let Some(DomValue::Attributes(attributes)) = inst.properties.get_mut(PROPERTY_NAME_ATTRIBUTES) {