Having issues with Rotating Part CFrame

I am trying to rotate a part 45 degrees every time it is clicked. At the moment when the part is clicked the cframe changes to a completely unintended, random number, can anybody help me out here? I tried 2 different ways I could think of with no success (as seen in the commented code)

imagePuzzle:FindFirstChild("TopRight").ClickDetector.MouseClick:Connect(function()
		imagePart = imagePuzzle:WaitForChild("TopRight")
		imageShuffleSound:Play()
		
		print(imagePart.CFrame)
		--imagePart.CFrame = CFrame.new(imagePart.CFrame.X, imagePart.CFrame.Y, imagePart.CFrame.Z + 45)
		imagePart.CFrame = CFrame.Angles(0, 0, math.rad(45))

		print(imagePart.CFrame)
	end)

thanks to anyone who is able to help me out :smiley:

imagePuzzle:FindFirstChild("TopRight").ClickDetector.MouseClick:Connect(function()
		imagePart = imagePuzzle:WaitForChild("TopRight")
		imageShuffleSound:Play()
		
		imagePart.Orientation += Vector3.new(0, 0, 45)
	end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.