02 | local mWasMissileFired = false |
04 | if mWasMissileFired = = false then |
05 | mWasMissileFired = true |
06 | main.Parent.Safe.Missiles.Missile:BreakJoints() |
08 | main.Parent.Safe.Missiles.Missile.Launch.Disabled = false |
11 | main.Parent.Safe.Missiles.Missile 2 :BreakJoints() |
13 | main.Parent.Safe.Missiles.Missile 2. Launch.Disabled = false |
14 | mWasMissileFired = false |
I recommend putting the whole launch missile script as a separate function, then add a plethora of boolean variables (assuming you only want the 2 missiles to fire and those 2 missiles only. You could add a regen function to restart the whole process):
10 | local mWasMissileFiredOnce = false |
11 | local mWasMissileFiredTwice = false |
13 | if mWasMissileFiredOnce = = false and mWasMissileFiredTwice = = false and debounce = = true then |
15 | main.Parent.Safe.Missiles.Missile:BreakJoints() |
18 | mWasMissileFiredOnce = true |
20 | elseif mWasMissileFiredOnce = = true and mWasMissileFiredTwice = = false and debounce = = true then |
23 | main.Parent.Safe.Missiles.Missile 2 :BreakJoints() |
26 | mWasMissileFiredTwice = true |
28 | elseif mWasMissileFiredOnce = = true and mWasMissileFiredTwice = = true then |
But assuming that you don't want a regen function, that you wanted to reload the missiles after a set amount of time or something. Well, you'd have to get rid of the BreakJoints() method and instead make a new part as a missile.
01 | mWasMissileFiredOnce = false |
02 | mWasMissileFiredTwice = false |
04 | FinishedShooting = script.Parent.FinishedShooting |
05 | FinishedShooting.Value = false |
17 | if mWasMissileFiredOnce = = false and mWasMissileFiredTwice = = false and FinishedShooting = = false and debounce = = true then |
19 | main.Parent.Safe.Missiles.Missile:BreakJoints() |
22 | mWasMissileFiredOnce = true |
24 | elseif mWasMissileFiredOnce = = true and mWasMissileFiredTwice = = false and FinishedShooting = = false and debounce = = true then |
27 | main.Parent.Safe.Missiles.Missile 2 :BreakJoints() |
30 | mWasMissileFiredTwice = true |
32 | FinishedShooting = true |
33 | elseif mWasMissileFiredOnce = = true and mWasMissileFiredTwice = = true then |
38 | FinishedShooting.Changed:connect( function (Value) |
39 | if FinishedShooting.Value = = true then |
41 | mWasMissileFiredOnce = false |
42 | mWasMissileFiredTwice = false |
43 | FinishedShooting.Value = false |