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

Rocket works fine the first time, but launches way too quickly the second time?

Asked by 4 years ago
Edited 4 years ago

Hello, I have built and scripted a rocket that is supposed to count down, launch, and then respawn. The rocket's first launch works perfectly, but after respawning the second launch is way too fast. I have unanchored the rocket after it has respawned and it has flown up into the air. I thought it had something to do with the position of the rocket when it respawned but I had no luck. When I walk into the rocket when I enter the game nothing happens, but after it has been respawned it flings my character.

Button = script.Parent.ClickDetector
Rocket = game.Workspace.RocketLauncher.Rocket
Screen = script.Parent.Parent.Screen.SurfaceGui.TextLabel
Engine = script.Parent.Parent.Parent.Rocket.RocketEngine

PosX = Rocket.Position.X
PosY = Rocket.Position.Y
PosZ = Rocket.Position.Z

Button.MouseClick:connect(function()
    if Rocket.Parent == game.Workspace.RocketLauncher then
    game.Workspace.RocketLauncher.Rocket.Anchored = true
    Screen.TextColor3 = Color3.fromRGB(175,175,18)
    Screen.Text = "3"
    print(3)
    wait(1)
    Screen.Text = "2"
    print(2)
    wait(1)
    Screen.Text = "1"
    print(1)
    wait(1)
    Screen.TextColor3 = Color3.fromRGB(0,175,0)
    Screen.Text = "Launch!"
    print("Launch!")
    local Heart = Instance.new("BodyForce")
    local Fire = Instance.new("ParticleEmitter")
    Heart.Parent = Rocket
    Fire.Parent = Rocket
    Fire.Enabled = true
    Fire.LightEmission = 0.2
    Fire.LightInfluence = 2
    Fire.Size = NumberSequence.new(10,10,10)
    Fire.Texture = "http://www.roblox.com/asset/?id=1111823942"
    Fire.Acceleration = Vector3.new(0,5,0)
    Fire.EmissionDirection = "Right"
    Fire.Transparency = NumberSequence.new(0,0,0)
    Fire.Rate = 30
    Fire. Speed = NumberRange.new(50,100)
    Fire.SpreadAngle = Vector2.new(2,2)
    Engine.Playing = true
    wait(1)
    Rocket.Anchored = false
    Rocket.CanCollide = false
    Heart.Force = Vector3.new(0,1000000,0)
    Screen.TextColor3 = Color3.fromRGB(175,20,5)
    Screen.Text = "Wait"
    wait(10)
    Engine.Playing = false
    Fire:Destroy()
    Heart.Force = Vector3.new(0,0,0)
    Heart:Destroy()
    Rocket.CanCollide = true
    Rocket.Parent = game.ServerStorage
    game.ServerStorage.Rocket.Position = Vector3.new(PosX,PosY,PosZ)
    wait(0.2)
    Rocket.Anchored = true
    wait(0.1)
    game.ServerStorage.Rocket.Parent = game.Workspace.RocketLauncher
    print("I'm ready!")
    Screen.TextColor3 = Color3.fromRGB(0,175,0)
    Screen.Text = "Ready"
    end
end)

0
Can you show a sample video? SoftlockedUnderZero 668 — 4y

Answer this question