Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a script end after the script runs?

Asked by 6 years ago

How to end a script after it runs?

2 answers

Log in to vote
0
Answered by 6 years ago

To end a script, just leave it. Or otherwise, if you don't want the script anymore after it's done doing its thing, delete the script itself.

To do this, write

script:Destroy()

on the script (replace 'script' with it's name).

'script' refers to itself and ':Destroy()' shows the action which is to destroy. So this means "destroy itself(script)"

Make sure to put it after the work on the script, or not it'll delete itself before the job ends.

Ad
Log in to vote
0
Answered by 6 years ago

You put an end, if it's loops or other stuff. otherwise leave it...

Example:

while wait() do --After I wait a litte while,
print("hi") --print hi
end --then end it.

Answer this question