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

This script keeps crashing my game and studio, is there any way to make it not?

Asked by 10 years ago

Basically this is a launch script that will work based on the new nerfed explosions and physics engine. I keep having issues pop up with Lines 64, 65, and 77. Can anyone read through this and help me correct it? (I am fairly new to RBX.Lua and scripting in Roblox as a whole so I apologize if I come off as "stupid").

The issue now is it lags out the server and studio to a crash after the script has gotten to Lines 40-42. (I am unsure if it gets to Line 42 because nothing happens after it displays "Ignition" in the Dev Console and as a hint)

Is there a way to make it so that all the script does is loop explosions after I hit a button? Or would that still crash it?

--Also how would I remove the hints after they have been displayed? (currently they are just layering over each other.)

print("Script Active. Waiting Launch.")
local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Ready for Launch."
Main = game.Workspace.Rocket.RocketModel.Head
Top = game.Workspace.Rocket.RocketModel.Head2
Booster = game.Workspace.Rocket.RocketModel.Booster
GantrySide = game.Workspace.Gantry.gantrymiddle.Side
Middle = game.Workspace.Rocket.RocketModel.Middle

game.Workspace.Rocket.Explosiontrigger.ClickDetector.MouseClick:connect(function (onClicked)
 local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launching in 10"
    print("Omicron I Launching in 10")
    wait(1)
    local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launching in 9"
    print("Omicron I Launching in 9")
    wait(1)
    local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launching in 8"
    print("Omicron I Launching in 8")
    wait(1)
    local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launching in 7"
    print("Omicron I Launching in 7")
    wait(1)
    local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launching in 6"
    print("Omicron I Launching in 6")
    wait(1)
    local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launching in 5"
    print("Omicron I Launching in 5")
    wait(1)
    local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launching in 4"
    print("Omicron I Launching in 4")
    wait(1)
    local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launching in 3"
    print("Omicron I Launching in 3")
    wait(1)
    local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launching in 2"
    print("Omicron I Launching in 2")
    wait(1)
    local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launching in 1"
    print("Omicron I Launching in 1")
    wait(1)
    local h = Instance.new("Hint",Workspace) h.Text = "Ignition"
    print("Ignition")
    wait(1)
    explosion = Instance.new("Explosion")
    explosion.BlastRadius = 25
    explosion.BlastPressure = 50
    explosion.DestroyJointRadiusPercent = 0
    explosion.Position = game.Workspace.Rocket.RocketModel.Booster.Position
    explosion.Parent = game.Workspace.Rocket.RocketModel.Booster
    wait(1)
    explosion = Instance.new("Explosion")
    explosion.BlastRadius = 25
    explosion.BlastPressure = 50
    explosion.DestroyJointRadiusPercent = 0
    explosion.Position = game.Workspace.Rocket.RocketModel.Booster.Position
    explosion.Parent = game.Workspace.Rocket.RocketModel.Booster
if
    Main.Velocity.y > 100
    then
    local h = Instance.new("Hint",Workspace) h.Text = "Liftoff."
    print("Liftoff")
    wait(2)
    explosion = Instance.new("Explosion")
    explosion.BlastRadius = 25
    explosion.BlastPressure = 60
    explosion.DestroyJointRadiusPercent = 0
    explosion.Position = game.Workspace.Rocket.RocketModel.Booster.Position
    explosion.Parent = game.Workspace.Rocket.RocketModel.Booster
else
    explosion = Instance.new("Explosion")
    explosion.BlastRadius = 25
    explosion.BlastPressure = 60
    explosion.DestroyJointRadiusPercent = 0
    explosion.Position = game.Workspace.Rocket.RocketModel.Booster.Position
    explosion.Parent = game.Workspace.Rocket.RocketModel.Booster
repeat
    explosion = Instance.new("Explosion")
    explosion.BlastRadius = 25
    explosion.BlastPressure = 70
    explosion.DestroyJointRadiusPercent = 0
    explosion.Position = game.Workspace.Rocket.RocketModel.Booster.Position
    explosion.Parent = game.Workspace.Rocket.RocketModel.Booster
until Main.Velocity.y > 1000
    wait(2)
    if Main.Velocity.y > 890
    then
    wait(5)
    if Main.Velocity.y > 780
        then
        wait(5)
        explosion = Instance.new("Explosion")
        explosion.BlastRadius = 25
        explosion.BlastPressure = 75
        explosion.DestroyJointRadiusPercent = 0
        explosion.Position = game.Workspace.Rocket.RocketModel.Booster.Position
        explosion.Parent = game.Workspace.Rocket.RocketModel.Booster
    else
        explosion = Instance.new("Explosion")
        explosion.BlastRadius = 25
        explosion.BlastPressure = 90
        explosion.DestroyJointRadiusPercent = 0
        explosion.Position = game.Workspace.Rocket.RocketModel.Booster.Position
        explosion.Parent = game.Workspace.Rocket.RocketModel.Booster
        if Main.Velocity.y < 1
            then
            local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launch Failed."
            print("Omicron I Launch Failed.")
            wait(2)
            local h = Instance.new("Hint",Workspace) h.Text = "Please contact Launch Administrators."
            print("Please contact Launch Administrators")
            wait(2)local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launch Failed."
            print("Omicron I Launch Failed.")
            wait(2)
            local h = Instance.new("Hint",Workspace) h.Text = "Please contact Launch Administrators."
            print("Please contact Launch Administrators")
            wait(2)local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launch Failed."
            print("Omicron I Launch Failed.")
            wait(2)
            local h = Instance.new("Hint",Workspace) h.Text = "Please contact Launch Administrators."
            print("Please contact Launch Administrators")
            wait(2)local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launch Failed."
            print("Omicron I Launch Failed.")
            wait(2)
            local h = Instance.new("Hint",Workspace) h.Text = "Please contact Launch Administrators."
            print("Please contact Launch Administrators")
            wait(2)
            local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launch Failed."
            print("Omicron I Launch Failed.")
            wait(2)
            local h = Instance.new("Hint",Workspace) h.Text = "Please contact Launch Administrators."
            print("Please contact Launch Administrators")
            wait(2)         
                print("Catastrophic Failure Imminent. Please Clear the Area.")
                local h = Instance.new("Hint",Workspace) h.Text ="Catastrophic Failure Imminent. Please Clear the Area."
                wait(2)
                print("Systems Failed. Catastrophic Failure Imminent. Please Clear the Area.")
                local h = Instance.new("Hint",Workspace) h.Text ="Systems Failed. Catastrophic Failure Imminent. Please Clear the Area."
                wait(2)
                print("Cooling Systems Failure. Danger Level - Extremely High")
                local h = Instance.new("Hint",Workspace) h.Text = "Cooling Systems Failure. Danger Level - Extremely High"
                wait(2)
                print("Cooling Systems Reboot...")
                local h = Instance.new("Hint",Workspace) h.Text = "Cooling Systems Reboot..."
                explosion = Instance.new("Explosion")
                    explosion.BlastRadius = 50
                    explosion.BlastPressure = 100000
                    explosion.DestroyJointRadiusPercent = 95
                    explosion.Position = game.Workspace.Rocket.RocketModel.Booster.Position
                    explosion.Parent = game.Workspace.Rocket.RocketModel.Booster
                    wait(1)
                    print("Reboot Failed. Catastrophic Failure Imminent. Please Clear the Area.")
                    local h = Instance.new("Hint",Workspace) h.Text = "Reboot Failed. Catastrophic Failure Imminent. Please Clear the Area."
                    wait(2)
                    explosion = Instance.new("Explosion")
                    explosion.BlastRadius = 15
                    explosion.BlastPressure = 40
                    explosion.DestroyJointRadiusPercent = 95
                    explosion.Position = game.Workspace.Gantry.Gantrymiddle.Side.Position
                    explosion.Parent = game.Workspace.Gantry.gantrymiddle.Side
                    wait(3)
                    print("Operational Systems Failed. Shutting Down...")
                    local h = Instance.new("Hint",Workspace) h.Text = "Operational Systems Failed. Shutting Down..."
                    wait(2)
                    explosion = Instance.new("Explosion")
                    explosion.BlastRadius = 35
                    explosion.BlastPressure = 95
                    explosion.DestroyJointRadiusPercent = 95
                    explosion.Position = game.Workspace.Rocket.RocketModel.Middle.Position
                    explosion.Parent = game.Workspace.Rocket.RocketModel.Middle
                    wait(1)
                    explosion = Instance.new("Explosion")
                    explosion.BlastRadius = 40
                    explosion.BlastPressure = 100
                    explosion.DestroyJointRadiusPercent = 95
                    explosion.Position = game.Workspace.Rocket.RocketModel.Top.Position
                    explosion.Parent = game.Workspace.Rocket.RocketModel.Head2
                    wait(5)
                end
            end
        end
end
end)
0
You might have a too big explosion, they sometimes lag the engine. gskw 1046 — 10y
0
Would that be the pressure that is causing the issue or the blast radius? areiydenfan00 115 — 10y

1 answer

Log in to vote
1
Answered by 10 years ago

It's might be of so much of it. It might be the problem. The best way to fix it is to reduce the lag. Look for the break points of the script.

0
so much of what??? areiydenfan00 115 — 10y
0
The script. TestingAndBuilding 10 — 10y
0
Also you might want to look at break points of the script. TestingAndBuilding 10 — 10y
1
Is there any way to simplify the script itself (like putting one type of explosion in a loop that keeps repeating itself? Also, I have seen games run on much larger scripts than this. areiydenfan00 115 — 10y
View all comments (3 more)
0
Well, when you loop it contuies on and on. It will crash if it like a nuke. TestingAndBuilding 10 — 10y
1
it is not even close to a nuke. All it is going to do is propel a rocket upward, which has been done multiple times by multiple people. areiydenfan00 115 — 10y
0
Well, I don't script but I do know stuff. You seen the bomb thing that loops that could be a problem. TestingAndBuilding 10 — 10y
Ad

Answer this question