How too stop a part from spinning

I made it where a part spins using the CFrame.

while wait() do
	script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0.1,0)
		Player.Character.Humanoid.Died:Connect(function()
	        wait(2)
          break
     end
end

I was wondering how I could stop it from spinning and break the loop. The script above is giving me an error saying that the “break” statement is outside of the loop. Im trying to make it where when the player dies, the loop breaks. Is there anyway to fix this?

local something = true
while something do
    task.wait()
	script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0.1,0)
		Player.Character.Humanoid.Died:Connect(function()
	        wait(2)
         something = false
     end
end

The problem is that you put the break in an event and not the loop and also use task.wait instead of wait. Use @rtvr56565"s code above.