@LKSim You could not switch targets till the current target is either , doesn't exist/dead, or starts/is interacting with another player that isn't yours(or if target is null of course).
EDIT: Btw I noticed you put this in the sub forum Snippets it's suppose to go in the general scripting help forum area.