--//Const

local RS = game:GetService("RunService");

function ViewportInit:Init(VP, Selected, CamCFrame)
	if (not VP) then return; end
	
	local Obj = Selected:Clone();
	
	if (not Obj.PrimaryPart) then
		for i,v in pairs(Obj:GetChildren()) do
			if (v:IsA("BasePart")) then
				Obj.PrimaryPart = v;
				break;
			end
		end	
	end

	Obj:SetPrimaryPartCFrame(CFrame.new(Vector3.new(), CamCFrame.Position))
	Obj.Parent = VP;

	local Camera = Instance.new("Camera");
	VP.CurrentCamera = Camera;
	Camera.Parent = VP;

	local cf = CamCFrame
	Camera.CFrame = cf


	return Obj, Camera;
end

return ViewportInit
