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

What am I doing wrong? [Solved]

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

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

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 = 50
    explosion.BlastPressure = 1000
    explosion.DestroyJointRadiusPercent = 0
    explosion.Position = Booster.Position
    explosion.Parent = game.Workspace
    wait(1)
    explosion = Instance.new("Explosion")
    explosion.BlastRadius = 50
    explosion.BlastPressure = 1000
    explosion.DestroyJointRadiusPercent = 0
    explosion.Position = Booster.Position
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 = 50
    explosion.BlastPressure = 750
    explosion.DestroyJointRadiusPercent = 0
    explosion.Position = Booster.Position
else
    explosion = Instance.new("Explosion")
    explosion.BlastRadius = 50
    explosion.BlastPressure = 2500
    explosion.DestroyJointRadiusPercent = 0
    explosion.Position = Booster.Position
repeat
    explosion = Instance.new("Explosion")
    explosion.BlastRadius = 50
    explosion.BlastPressure = 3000
    explosion.DestroyJointRadiusPercent = 0
    explosion.Position = game.Workspace.Rocket.RocketModel.Booster
until Main.Velocity.y > 21000
    wait(2)
    if Main.Velocity.y > 20000
    then
    wait(5)
    if Main.Velocity.y > 19500
        then
        wait(5)
        explosion = Instance.new("Explosion")
        explosion.BlastRadius = 50
        explosion.BlastPressure = 2500
        explosion.DestroyJointRadiusPercent = 0
        explosion.Position = Booster.Position
    else
        explosion = Instance.new("Explosion")
        explosion.BlastRadius = 50
        explosion.BlastPressure = 4750
        explosion.DestroyJointRadiusPercent = 0
        explosion.Position = Booster.Position
        if Main.Velocity.y < 1
            then
            local h = Instance.new("Hint",Workspace) h.Text = "Omicron I Launch Failed."
            wait(2)
            local h = Instance.new("Hint",Workspace) h.Text = "Please contact Launch Administrators."
            wait(2)
            repeat

            until Main.Velocity.y > 10
            if Main.Velocity.y > 10
                then
                print("Catastrophic Failure Imminent.")
                local h = Instance.new("Hint",Workspace) h.Text ="Catastrophic Failure Imminent. Please Clear the Area."
                wait(2)
                local h = Instance.new("Hint",Workspace) h.Text ="Systems Failed. Catastrophic Failure Imminent. Please Clear the Area"
                wait(2)
                local h = Instance.new("Hint",Workspace) h.Text = "Cooling Systems Failure. Danger Level - Extremely High"
                wait(2)
                local h = Instance.new("Hint",Workspace) h.Text = "Cooling Systems Reboot..."
                explosion = Instance.new("Explosion")
                    explosion.BlastRadius = 50
                    explosion.BlastPressure = 100000
                    explosion.DestroyJointRadius = 95
                    explosion.Position = Booster.Position
                    wait(1)
                    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 = 25
                    explosion.BlastPressure = 5000
                    explosion.DestroyJointRadius = 95
                    explosion.Position = GantrySide.Position
                    wait(3)
                    local h = Instance.new("Hint",Workspace) h.Text = "Operational Systems Failed. Shutting Down..."
                    wait(2)
                    explosion = Instance.new("Explosion")
                    explosion.BlastRadius = 125
                    explosion.BlastPressure = 500000
                    explosion.DestroyJointRadius = 95
                    explosion.Position = Middle.Position
                    wait(1)
                    explosion = Instance.new("Explosion")
                    explosion.BlastRadius = 185
                    explosion.BlastPressure = 7500
                    explosion.DestroyJointRadius = 95
                    explosion.Position = Top.Position
                    wait(5)
                    end
                end
            end
        end
    end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

Dev Console/Output:

20:00:25 -- Workspace.rocket.Explosion trigger.Script:77: bad argument #3 to 'Position' (Vector3 expected, got userdata) 20:00:25 -- Script 'Workspace.Rocket.Explosion trigger.Script', Line 77 20:00:25 -- Stack End

1 answer

Log in to vote
1
Answered by 10 years ago

Probably an extra end. Remove the end on line 32.

0
132* DominusAstra -2 — 10y
0
it worked, now I'm doing a bunch more trouble-shooting on it... go figure.... areiydenfan00 115 — 10y
Ad

Answer this question