Selection:Get only Selects Two Objects

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Change all selected objects

  2. What is the issue? It only changes two parts

Found nothing related to this on Developer hub

-- Change the texture
selected.ChangeTexture.MouseButton1Click:Connect(function()

	local recording = CHS:TryBeginRecording("Set texture to mesh")
	if not recording then
	warn("Recording never finished.")
		return
	end
	
	local selectedObjects = selection:Get()

	for _, mesh in pairs(selectedObjects) do
		if mesh:IsA("MeshPart") then
			local imageLabel = mesh.SurfaceGui.ImageLabel

			local texture =  selected.SelectedTile.Image
			local offset = selected.SelectedTile.ImageRectOffset
			local size = selected.SelectedTile.ImageRectSize

			imageLabel.ImageRectOffset = offset
			imageLabel.ImageRectSize = size
			imageLabel.Image = texture
			
			CHS:FinishRecording(recording, Enum.FinishRecordingOperation.Commit)
		end
	end
end)
1 Like

Can you please print out the value of selectedObjects to confirm that it isn’t retrieving the selected objects correctly, instead of having the loop error / have some othe rissue.

Issue was FinishRecording was in the for loop.