sed is not seductive.

Failed attempt: array_unique compliant on shellscript

I've just started writing shellscript. I am noob and unfortunately, stupid enough not to be able to write array_unique compliant by myself. I wanted to know the way to elegantly implement array_unique compliant on shellscript, but Google didn't help me out.

FYI, I pasted the code supposed to work correctly as far as I expect.

#!/bin/bash

# Array containing non-unique elements
ArrayNotUnique=(AK47 SR-16 MP5 M4 MP5 AA-12 AK47 Type89 AK47)

# It doesn't work! f*!
$UniqueArray=($(echo ${ArrayNotUnique[@]} | sed s/\s/\n/g | sort | uniq | sed s/\n/\s/g)) 

I don't understand.