I'm trying to make a script that picks two random things and then make sure they do not repeat. I currently have:
admin={"parkderp1","random","name"} for i=2, do pick=admin[math.random(1,#admin)] wait(0.01) print(pick) end
Thats working i just dont know how to check if they repeat by repeating i mean the output being: parkderp1,parkderp1
A really simple way is to keep re-picking until the choice is not what it was the time before, e.g.,
local previousChoice = nil local list = {"abc","def", "ghi"} while true do wait(1) local choice repeat choice = list[ math.random(1, #list) ] until choice ~= previousChoice previousChoice = choice print(choice) end
Warning: If there's only one element in the list, this will cause an infinite loop.