Can I copy to clipboard a table?

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…

Use HTTPService to JSONEncode it, then try copying the encoded version. It’ll be significantly closer to what you want

Using JSONEncode nullifies non-primitive types.

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)
1 Like

you can try using some tool like this IG RBLXSerialize - a easy to use and really cool all-in-one Roblox Serializer

1 Like

Kinda works but it adds quotes before and after Vector3.new(...).

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

1 Like

I guess I’ll remove them manually, better than adding vector3;newioefjgbqkjf I guess…

1 Like

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