The following rule should clarify your question: “If a player, in the same turn, casts a spell or makes an attack action that is augmented by a random property and would have hit someone if not for their Luck save, the die from the Random Property table is rolled again to determine if the original effect will now work.” (5th Edition Player’s Handbook p.239)
You may re-roll an attack action that was augmented by a random property once per turn with luck. This means you can’t re-roll it twice in one turn. For example, if you attacked as normal but didn’t do any damage because of their high AC – as long as they failed their look save – then you cannot re-roll it in order to get lucky enough to hit them. But if you had equally high AC and rolled a critical fail, you can re-roll it once in order to damage your enemy.
If the die was already used in the attack roll, then re-rolling will not change anything. You may want to use one of the options provided by the re-roll and ignore the roll.