Yea i had that issue before but
if you look at the code :
-You are going to call it if you spawn
-Only moves the barriers that have a lower z axis that you have after you spawned
there is no way you are going to die after adding the code
but the most importent thing is to call it on onPlayerSpawned