I am converting a :toObjectSpace() to a :toWorldSpace() and have created this function to do so, however, it keeps erroring this error and I’m not sure why:
invalid argument #1 to 'new' (Vector3 expected, got string)
Here is my code:
local function loadObjectToWorldCF(target, storedKey)
-- storedKey is a string
-- target is a part inside of workspace
print(storedKey)
local world = target.CFrame:toWorldSpace(CFrame.new(storedKey))
workspace.CurrentCamera.Focus = CFrame.new(target.Position)
workspace.CurrentCamera.CFrame = world
end
The CFrame is being stored in a StringValue, so when I go to retrieve the CFrame, I say stringvalue.Value, which will give me a string. How can I convert this into a CFrame that CFrame.new() can understand?
CFrameValue.Value is a CFrame.new() object. Which I can think you can save to DataStore, it was what @0929lego was doing, but correct me if I am wrong.