this script makes 2 grid 1 to display the Color / material the other to detect parts in front of it so it knows what Color / Material it should display No errors it changes Color / Material but that's perminite i want it to dispaear when you stop touching a detectorPart it Crashes studio Code:

local Size = Vector2.new(script.Parent.Backround.Size.X,script.Parent.Backround.Size.Y)
Distance = 10
Resaoltion = Vector3.new(1,1,1)
FPS = 1
BasePosition = Vector3.new(-21.5, -0.5, 0.5)
------function------------
	GetPart = function(Part1,Part2)
		Part1.Touched:Connect(function(hit)
			Part2.Color = hit.Color
			Part2.Material = hit.Material
		end)
	end
-----Mirror------
for X=1, Size.X do
	for Y=1, Size.Y do
		MX = X
		MY = Y
		local Part = Instance.new("Part")
		Part.Material = "SmoothPlastic"
		Part.Anchored = true
		Part.Color = Color3.fromRGB(255,255,255)
		Part.Name = "Part [" .. X .. "," ..Y .. "]"
		Part.Size = Resaoltion
	    Part.Position = BasePosition + Vector3.new(Resaoltion.X*X, Resaoltion.Y*Y,1)
	    Part.Parent = script.Parent
	end
end
-----------Script that makes it work-------------------
for X=1, Size.X do
	for Y=1, Size.Y do
		DX = X
		DY = Y
		local Part2 = Instance.new("Part")
		Part2.Material = "SmoothPlastic"
		Part2.Anchored = true
		Part2.Color = Color3.fromRGB(255,255,255)
		Part2.Name = "DtectorPart [" .. X .. "," ..Y .. "]"
		Part2.CanCollide = false
		Part2.Transparency = 1
		Part2.Size = Vector3.new(Resaoltion.X,Resaoltion.Y,Distance)
	    Part2.Position = BasePosition + Vector3.new(Resaoltion.X*X, Resaoltion.Y*Y,Distance/2+(1-.5))
	    Part2.Parent = script.Parent
	end
end

while true do
	for X=1,Size.X do
		for Y=1, Size.Y do
			script.Parent["DtectorPart [" .. X .. "," .. Y .. "]"].Touched:Connect(function(hit)
				    script.Parent["Part [" .. X .. "," .. Y .. "]"].Color = hit.Color
				    script.Parent["Part [" .. X .. "," .. Y .. "]"] = hit.Material
				   
				    
			end)
		end
	end

wait(1/FPS)
end