I'd like to make a game loop script that'd restart on a condition, say like a player disconnects from the game in the middle of a battle, and the next lines are reliant on the player object existing, how do I just reset the script?
The command break
will break out of a loop. What you could do is have the entire loop in another loop, so when you break out of the game loop, the outside loop will make sure the game loop restarts. This is what I mean:
while wait() do --Everything in this loop will keep going when break is called on the enclosing loop while wait() do --Game loop stuff if not condition then break end end end