I want to store the tables containing hard-coded builds of my game – that I created using a script – in a ModuleScript, but I can’t.
I tried printing the table, copying it, pasting it in a ModuleScript, and removing the ▼ characters; which would have worked, if the table didn’t contain Vector3 values. Vector3 values are printed like this: ["Position"] = -5.50000048, 5.49999905, -5.5, not like this: ["Position"] = Vector3.new(-5.50000048, 5.49999905, -5.5), so it doesn’t work.
I searched for Table object values but it doesn’t exist.
Please help me, as the only workaround I can think of is using DataStoreService, but it isn’t 100% reliable and there’s size limits so…
Using this method prints ["Position"] = "Vector3.new(1, 2, 3)" in the output:
local originalTable = {
Position = Vector3.new(1, 2, 3)
}
local newTable = {}
for key, value in originalTable do
if typeof(value) == "Vector3" then
newTable[key] = "Vector3.new("..tostring(value)..")"
else
newTable[key] = value
end
end
print(newTable)
That’s because this method converts it to a string value (I admit I should have clarified that). As far as I’m aware there isn’t a way to store a Vector3 value within a table and make it print Vector3.new(x, y, z) afterwards without having to convert it to a string value first since the output only prints the x, y, z values otherwise