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

How would I make a transition from one script to another, then remove the original script?

Asked by
3dsonicdx 163
10 years ago

I've been working on a different method for my game instead of lumping everything all into one Master Script(It isn't bad, but I wanted to switch things around a bit more.)

So basically, I have ScriptA.

while true do

-- Random Stuff here

wait(1)
Owl = game.Lighting.Location.ScriptB:clone()
Owl.Parent = game.Workspace
wait(1)
game.Workspace.ScriptA:remove()

So ScriptA is located in the Workspace, and I am moving ScriptB to the workspace from the lighting. Now my problem is, I am trying to get rid of ScriptA. Disabling won't do(It tends to pile up ._.)

And ScriptB technically does the same thing as ScriptA(Does stuff, then moves onto ScriptC)

-Thanks!

0
Sounds like OOP... Um, idk what to do but... Have you tried setting it to Wumbo? (I'll try to answer when I get home.) OniiCh_n 410 — 10y

3 answers

Log in to vote
1
Answered by
Mowblow 117
10 years ago

Try taking it out of the loop. Put it after the loop, it should still run. I think your script is bugging out because that same code keeps running over and over. Once you've done this, try the disabling method again. And another thing, master scripts are not bad. Try using those (if you really don't want to, that is fine, it is just what I recommend).

0
I didn't say 'masterscripts weren't bad'. "(It isn't bad, but I wanted to switch things around a bit more.)". I'm aiming at a different method. As for taking it out of the loop, I'll try that. 3dsonicdx 163 — 10y
Ad
Log in to vote
0
Answered by
OniiCh_n 410 Moderation Voter
10 years ago

I have an idea. Disable ScriptB, then before ScriptA commits suicide, (use :Destroy() instead) enable the clone of ScriptB. Voila?

0
So you want me to spawn ScriptB (That was pre-disabled). Enable Script B, then Destroy Script A? 3dsonicdx 163 — 10y
Log in to vote
0
Answered by
c0des 207 Moderation Voter
10 years ago
while true do
--Whatever here
wait(1)
Owl = game.Lighting.Location.ScriptB:clone()
Owl.Parent = game.Workspace
return false

Answer this question