Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why can't I save a CFrame inside a table thats inside another table?

table.insert(save.CorFrame, v.CFrame:GetComponents())
local save = {
	CorFrame = {
		
		
		}
	}

Just errors:

20:22:10.107 - Workspace.Script:15: wrong number of arguments to 'insert'
20:22:10.107 - Stack Begin
20:22:10.108 - Script 'Workspace.Script', Line 15
20:22:10.108 - Stack End

1 answer

The reason you're getting this error is that CFrame:GetComponents() returns more than one variable. It copies all the possible components from the CFrame and returns them.

Returns the values: x, y, z, R00, R01, R02, R10, R11, R12, R20, R21, R22, where R00-R22 represent the 3x3 rotation matrix of the CFrame, and xyz represent the position of the CFrame.

If you simply want to return the CFrame itself, then you can leave off the :GetCompontents() portion. If you insist on keeping all the data from the GetComponents() portion, then you could do something like this:

v = Instance.new("Part",game.Workspace);
local save = {
	["CorFrame"] = {
	 
        }
    }
table.insert(save.CorFrame, {v.CFrame:GetComponents()});

I'm returning the variables inside a table that way it can save that single table in this example.

This discussion is preserved as it was. New answers, comments, and votes are closed.