So I have like 30 objects of the same name and each has an IntValue. When the player's weapon collides with one of the objects, the object's IntValue increases by one. When one of the object's IntValue reaches a specific value I need it to teleport to a certain location for a short period of time then return to it's original location and have it's IntValue reset.
I already know how to do most of this but I don't know how to have one script handle all of them. I tried making a server script that loops through all of them and constantly checks their IntValues until one of them reaches the specific value it needs to reach, then the script teleports that specific object and does the rest of the stuff. The problem here is when the script gets to the point where it needs to wait a short period of time before returning the object to it's original position, everything pauses until that short period of time is over. So even if any of the other objects reached that specific value nothing happens because the script is paused.
So is there any better way to handle such situation? And if my IntValue approach sucks and there is a better way to do this please do enlighten me. All i'm really trying to do here is destroy objects after the player hits them for a number of times then have them regenerate, but i'm faking the destruction part by having the destroyed object just teleport away for a while then come back to it's original position because it's simple to do it this way.
I don't what your actual problem has to do with your title. You should use pseudo-threading so more stuff can happen. It's possible to use spawn() or delay() but best is to connect the IntValue.Changed events. This is an event based engine.
Also the teleport stuff is just inconvenient or even taking memory so why not set Parent to nil?