Call it in the button handler :
var justOnce: Bool = true
@IBAction func playStats(_ sender: Any) {
//show alert only once
if justOnce {
let alert = UIAlertController(title: "Stats Important", message: "You can copy and paste the name here when you see the searchbar", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK",
style: UIAlertAction.Style.default,
handler: {_ in
justOnce = false
gotoSite()
} ))
self.present(alert, animated: true, completion: nil)
}
}