local P,G=Vector3.new,CFrame.new local w,U=string.match,math.max local z,i=P(1,.1,1),G(0,-0.1,0)local A={}function A.new(P,G)assert(P and(type(P)=="\115\116\114\105\110\103"and w(P,"\037\100\043")),"\073\110\118\097\108\105\100 \073\109\097\103\101 \073\068\058 "..P)assert(G and(type(G)=="\115\116\114\105\110\103"and script:FindFirstChild(G)),"\073\110\118\097\108\105\100 \067\108\105\112\112\101\114 \084\121\112\101\058 "..G)local A=(script:FindFirstChild(G)):Clone()A.Size=z A.CFrame=i A.Transparency=1 local I=Decal:Clone()I.Texture=P local Q=Camera:Clone()Q.CFrame=CFrame.new(Vector3.new(0,(U(A.Size.X,A.Size.Z)/2)/.17,0),Vector3.new())*CFrame.Angles(0,0,-1.5707963267949)local d=ViewportFrame:Clone()d.CurrentCamera=Q I.Parent=A A.Parent=d Q.Parent=d return d,A end return A

local v3,cf		= Vector3.new,CFrame.new
local match,max	= string.match,math.max
local clipperSize, clipperCF = v3(1,0.1,1), cf(0,-0.1,0)


local module = {}

function module.new(ID, Type)
	
	--Sanity checks
	assert(ID and type(ID) == "string" and match(ID,"%d+"), "Invalid Image ID: "..ID)
	assert(Type and type(Type) == "string" and script:FindFirstChild(Type), "Invalid Clipper Type: "..Type)
	
	--Clipper mesh
	local Clipper	= script:FindFirstChild(Type):Clone()
		Clipper.Size			= clipperSize
		Clipper.CFrame			= clipperCF
		Clipper.Transparency	= 1
		
	--Decal Image
	local Image		= Decal:Clone()
		Image.Texture			= ID
		
	--Camera renderpoint
	local Cam		= Camera:Clone()
		Cam.CFrame				= CFrame.new(Vector3.new(0,(max(Clipper.Size.X,Clipper.Size.Z)/2)/0.17,0),Vector3.new())*CFrame.Angles(0,0,-1.5707963267949)
		
	--ViewportFrame
	local Frame		= ViewportFrame:Clone()
		Frame.CurrentCamera		= Cam

	--Finalize setup
	Image.Parent	= Clipper
	Clipper.Parent	= Frame
	Cam.Parent		= Frame	--If Frame is deleted, so is Cam (avoiding mem leaks)
	
	return Frame, Clipper
	
end

return module
