I have a self shell ejection cannon and it works great, the problem though is, while its reloading, if you continue to press the fire button (which is a GUI) the eject script will still continue to function thus cloning several casings while the gun is still reloading. I tried to disable the ejection script in the main script but it only ends up disabling it permanently. Here's the code
repeat wait() until script.Parent.Parent.Vehicle.Value~=nil
db=false
held=false
v=script.Parent.Parent.Vehicle
f=script.Parent
missile=script.Parent.HE
e=script.Parent.Eject
function fireguns()
v1=v.Value.Gun1Bullet:clone()
vel=Instance.new("BodyVelocity")
vel.Parent=v1
v1.Velocity=v1.CFrame.lookVector*500
v1.BodyVelocity.maxForce=Vector3.new(4000, 0, 4000)
vel.velocity=v1.Velocity
v1.CanCollide=true
v1.Transparency=0
v1.Damage.Disabled=false
v1.Parent=workspace
end
function launchmissile()
v.Value.Effect.PointLight.Enabled = true
v.Value.Effect.Smoke.Enabled = true
v.Value.Effect.Fire:Play()
v.Value.Effect.Transparency = .5
v.Value.WER2.Value.C0 = v.Value.WER2.Value.C0 - Vector3.new(0,0, .5)
v1=v.Value.Missile:clone()
v1.CFrame = v.Value.Missile.CFrame * CFrame.new(0, 0, -5)
vel=Instance.new("BodyVelocity")
vel.Parent=v1
v1.Velocity=v1.CFrame.lookVector*500
v1.BodyVelocity.maxForce=Vector3.new(4000, 0, 4000)
vel.velocity=v1.Velocity
v1.CanCollide=true
v1.Transparency= 0
v1.Heat.Disabled=false
v1.Parent=workspace
wait(.1)
v.Value.WER2.Value.C0 = v.Value.WER2.Value.C0 + Vector3.new(0,0, .1)
v.Value.Effect.Transparency = .6
wait(.1)
v.Value.WER2.Value.C0 = v.Value.WER2.Value.C0 + Vector3.new(0,0, .1)
v.Value.Effect.Transparency = .7
wait(.1)
v.Value.WER2.Value.C0 = v.Value.WER2.Value.C0 + Vector3.new(0,0, .1)
v.Value.Effect.Transparency = .8
wait(.1)
v.Value.WER2.Value.C0 = v.Value.WER2.Value.C0 + Vector3.new(0,0, .1)
v.Value.Effect.Transparency = .9
wait(.1)
v.Value.WER2.Value.C0 = v.Value.WER2.Value.C0 + Vector3.new(0,0, .1)
v.Value.Effect.Transparency = 1
v.Value.Effect.PointLight.Enabled = false
v.Value.Effect.Smoke.Enabled = false
wait(.5)
end
function missileclick()
print("click missile")
if db==true then return end
db=true
missile.Text="Reloading"
e.Disabled = true
launchmissile()
v.Value.Effect.Reload:Play()
wait(3)
missile.Text="Fire HEAT"
v.Value.Effect.Reload:Stop()
e.Disabled = false
db=false
end
function gunsdown()
held=true
while held==true do
fireguns()
wait()
end
end
function gunsup()
held=false
print("up")
end
missile.MouseButton1Click:connect(missileclick)
sabot.MouseButton1Click:connect(sabotclick)
guns.MouseButton1Down:connect(gunsdown)
guns.MouseButton1Up:connect(gunsup)

2 comments
I found out that making the missile.Visible = false will make it so that while reloading, the button will disappear rendering it 'unclickable' but I prefer this method. Thanks!
You're welcome.