Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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!

1 comment

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.)

3 answers

✓ Accepted answer

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).

1 comment

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.

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

1 comment

0

So you want me to spawn ScriptB (That was pre-disabled). Enable Script B, then Destroy Script A?

while true do
--Whatever here
wait(1)
Owl = game.Lighting.Location.ScriptB:clone()
Owl.Parent = game.Workspace
return false

This discussion is preserved as it was. New answers, comments, and votes are closed.