I'm not an expert on 3d programming, but I'm pretty sure that if you make a variable to keep track of the amount of times the cube bobs up and down, you should be able to stop it from bobbing after a certain amount of time. Like this:
-----------------------------------------------------------------------------
bob=5
if bob>=1 then
[insert bobbing code here]
bob=bob-1
end if
-----------------------------------------------------------------------------
bob=5
if bob>=1 then
[insert bobbing code here]
bob=bob-1
end if