@adiholick/nvstudio-mcp 2.2.1 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,9 +40,32 @@ return function(targetInstance, data, ctx, targetPath)
40
40
  tryProp(prop)
41
41
  end
42
42
 
43
- -- Attributes & Tags
43
+ -- Attributes & Tags (sanitasi tipe non-JSON agar tidak throw error di JSONEncode)
44
44
  pcall(function()
45
- props.Attributes = targetInstance:GetAttributes()
45
+ local rawAttrs = targetInstance:GetAttributes()
46
+ local safeAttrs = {}
47
+ for k, val in pairs(rawAttrs) do
48
+ if typeof(val) == "Vector3" then
49
+ safeAttrs[k] = {math.round(val.X*100)/100, math.round(val.Y*100)/100, math.round(val.Z*100)/100}
50
+ elseif typeof(val) == "Color3" then
51
+ safeAttrs[k] = {math.round(val.R * 255), math.round(val.G * 255), math.round(val.B * 255)}
52
+ elseif typeof(val) == "CFrame" then
53
+ safeAttrs[k] = tostring(val)
54
+ elseif typeof(val) == "EnumItem" then
55
+ safeAttrs[k] = val.Name
56
+ elseif typeof(val) == "UDim2" then
57
+ safeAttrs[k] = {val.X.Scale, val.X.Offset, val.Y.Scale, val.Y.Offset}
58
+ elseif typeof(val) == "Instance" then
59
+ safeAttrs[k] = val:GetFullName()
60
+ elseif typeof(val) == "DateTime" then
61
+ safeAttrs[k] = val:ToIsoDate()
62
+ elseif typeof(val) == "string" or typeof(val) == "number" or typeof(val) == "boolean" then
63
+ safeAttrs[k] = val
64
+ else
65
+ safeAttrs[k] = tostring(val)
66
+ end
67
+ end
68
+ props.Attributes = safeAttrs
46
69
  end)
47
70
  pcall(function()
48
71
  props.Tags = CollectionService:GetTags(targetInstance)