Repeat interval with AppleScript

Hello everyone!

I am trying to copy the recurrence of a task in OF to another task. However, I’m struggling with apple script now for several hours and I can’t find the code that work.

Does anyone can help me out?

Cheers
Christian

set theRepetition to repetition rule of selectedItem
set theInterval to repetition of selectedItem

--log (theRepetition) =(*recurrence:FREQ=DAILY, repetition method:fixed repetition*)
--log (theInterval) = (*unit:day, steps:1, fixed:true*)
tell default document		
		--set repetition interval of nextTask to theInterval
		tell nextTask to set repetition to  theInterval
		tell nextTask to set repetition rule to  theRepetition -- error
		
end tell

I have found my error, it was a few lines before. This code works for setting the repetition:

tell default document
    set theInterval to repetition of selectedItem
    set otherTask to second flattened task of ...
    tell otherTask to set repetition to theInterval

end tell