Questions with TABLES!

How would I change this table so I don’t get the UT - 8 Characters error message?

{
									["Transform"] = {
										obj.CFrame.X,
										obj.CFrame.Y,
										obj.CFrame.Z,
										obj.Orientation.Y,
										obj.Orientation.X,
									},
									["Properties"] = {
										obj.Color.R,
										obj.Color.G,
										obj.Color.B,
										obj.Name,
										obj.Material,	
									},
								}
2 Likes

If you are trying to save this in a data store, I don’t believe you can store enums in data stores.
The only valid things you can store in data stores would be strings, numbers, booleans, and non-mixed tables. Other instances or data types like functions or Roblox data types can’t be stored because they cannot be serialized via JSON.

All stuff stored in datastores are converted to JSON when saved and then decoded back to a table when you grab it from the datastore. So everything in your table is fine except for storing the Material Enum.

1 Like

How would I make it so that the Material can be saved into a string?

1 Like

.tostring(obj.Material), use this to convert the material into a string, then save it.

Here’s the fix:

{
									["Transform"] = {
										obj.CFrame.X,
										obj.CFrame.Y,
										obj.CFrame.Z,
										obj.Orientation.Y,
										obj.Orientation.X,
									},
									["Properties"] = {
										obj.Color.R,
										obj.Color.G,
										obj.Color.B,
										obj.Name,
										tostring(obj.Material),	
									},
								}
1 Like

This article should be of use to you:

1 Like

u know that EnumItem.Name and EnumItem.Value exists right

1 Like

literally the same thing, wont change anything whatever way you do it

1 Like

If you care about data compression then it probably does matter because you would want to use the enum’s ID instead since that is an integer which, if isn’t already compact enough, you can encode it into base64 as a single character rather than an entire string of name

1 Like

Please elaborate on what I would do.

1 Like

They are just saying(I think) that you can use:

obj.Material.Name  --a string
--or
obj.Material.Value  --a number

instead of:

tostring(obj.Material)

store it whichever way you like in the datastore, a number takes up less space than a string though

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.