Redirecting script

Is it possible to make redirect script? Im planning on moving my server from 1 box to another and I want people to be able to redirect from old IP to new one but I dont know if its possible or how to do it any help would be appreciated.

for k,v in pairs(player.GetAll()) do
    v:ConCommand("connect ip")

where would I put that?

That’s not the actual function or command , that is just the snippet what allows you to change server.