As I've heard everything happens according to the Allah's consent.
So imagine there's a cricket match between Pakistan and Afghanistan. Both the team members are worshiping Allah before the game and while playing the game. So in that case how Allah decide who should win the game. And if Pakistan wins then what's the point of worshiping Allah by Afghanistan players? (And other eay round)