This is probably gonna be really vague. There's like... a machine (I feel like it may be kind of like a loom?) in a big room that prints out scripts or something that decide that someone is supposed to die or something is supposed to happen? The decisions are like passed down from some higher up deciding group or something.. And someone finds out about it and it turns out in the end that one dude who was supposed to carry out the scripts was messing with stuff so he could be the person who decides who dies and stuff?
Haha sorry if that made no sense, my memory for movies is terrible and I often blend multiple movies together as one plot lol.