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

How can I make the blaster not shoot the orange/blue laser after the normal laser?

Asked by 2 years ago

Hey

As the title says, the tool will shoot the orange/blue laser after the normal laser (The normal Is white)

Script:

local Tool = script.Parent

Tool.RemoteEvent.OnServerEvent:Connect(function()
    local GastGun = game:GetService("ReplicatedStorage").VisualEffectMesh["Gast Gun"]:Clone()
    game:GetService("Debris"):AddItem(GastGun,5)
    GastGun.Parent = game.Workspace
    GastGun.Position = Tool.Parent.Torso.Position
    GastGun.Orientation = Tool.Parent.Torso.Orientation
    GastGun.Transparency = 1
    local TweenProperties = {
        CFrame = GastGun.CFrame + (GastGun.CFrame.LookVector*5),
        Transparency = 0
    }
    local Tweeninfo = TweenInfo.new(
        1,
        Enum.EasingStyle.Bounce,
        Enum.EasingDirection.Out,
        0,
        false,
        0
    )
    local Tween = game:GetService("TweenService"):Create(GastGun,Tweeninfo,TweenProperties)
    Tween:Play()
    Tool.Parent.Sounds.OhGodNo:Play()
    wait(0.469)
    local LaserType = math.random(1,10)

    if LaserType ~= 5 or 10 then
        local LASER = game:GetService("ReplicatedStorage").VisualEffectMesh["Lazer"]:Clone()
        game:GetService("Debris"):AddItem(LASER,5)
        Tool.Parent.Sounds.Death:Play()
        LASER.Parent = game.Workspace
        LASER.Position = GastGun.Position
        LASER.Orientation = GastGun.Orientation
        LASER.CFrame = LASER.CFrame + (LASER.CFrame.LookVector*17)
        GastGun.Position = GastGun.Position + Vector3.new(0,5,0)
        for i=0, 10 do
            LASER.Size = LASER.Size + Vector3.new(0.1,1,10)
            LASER.CFrame = LASER.CFrame * CFrame.new(0,0,-10/2)
            LASER.Touched:Connect(function(hit)
                local humanoid = hit.Parent:WaitForChild("Humanoid")
                if humanoid ~= Tool.Parent.Humanoid then
                    humanoid:TakeDamage(math.random(1,5))
                    wait(0.1)
                end
            end)
            wait()
        end
        game:GetService("Debris"):AddItem(LASER,0)
        game:GetService("Debris"):AddItem(GastGun,0)
    end
    if LaserType == 5 then
        local LASER = game:GetService("ReplicatedStorage").VisualEffectMesh["Lazer"]:Clone()
        game:GetService("Debris"):AddItem(LASER,5)
        Tool.Parent.Sounds.Death:Play()
        LASER.Parent = game.Workspace
        LASER.Position = GastGun.Position
        LASER.Orientation = GastGun.Orientation
        LASER.CFrame = LASER.CFrame + (LASER.CFrame.LookVector*17)
        LASER.BrickColor = BrickColor.new("Neon orange")
        GastGun.Position = GastGun.Position + Vector3.new(0,5,0)
        for i=0, 10 do
            LASER.Size = LASER.Size + Vector3.new(0.1,1,10)
            LASER.CFrame = LASER.CFrame * CFrame.new(0,0,-10/2)
            LASER.Touched:Connect(function(hit)
                local humanoid = hit.Parent:WaitForChild("Humanoid")
                if humanoid ~= Tool.Parent.Humanoid then
                    local WalkSpeed = humanoid.Running:Connect(function(Speed)
                        if Speed < 1 then
                            humanoid:TakeDamage(math.random(1,5))
                            wait(0.1)
                        end
                    end)
                end
            end)
            wait()
        end
        game:GetService("Debris"):AddItem(LASER,0)
        game:GetService("Debris"):AddItem(GastGun,0)
    end
    if LaserType == 10 then
        local LASER = game:GetService("ReplicatedStorage").VisualEffectMesh["Lazer"]:Clone()
        game:GetService("Debris"):AddItem(LASER,5)
        Tool.Parent.Sounds.Death:Play()
        LASER.Parent = game.Workspace
        LASER.Position = GastGun.Position
        LASER.Orientation = GastGun.Orientation
        LASER.CFrame = LASER.CFrame + (LASER.CFrame.LookVector*17)
        LASER.BrickColor = BrickColor.Blue()
        GastGun.Position = GastGun.Position + Vector3.new(0,5,0)
        for i=0, 10 do
            LASER.Size = LASER.Size + Vector3.new(0.1,1,10)
            LASER.CFrame = LASER.CFrame * CFrame.new(0,0,-10/2)
            LASER.Touched:Connect(function(hit)
                local humanoid = hit.Parent:WaitForChild("Humanoid")
                if humanoid ~= Tool.Parent.Humanoid then
                    local WalkSpeed = humanoid.Running:Connect(function(Speed)
                        if Speed > 1 then
                            humanoid:TakeDamage(math.random(1,5))
                            wait(0.1)
                        end
                    end)
                end
            end)
            wait()
        end
        game:GetService("Debris"):AddItem(LASER,0)
        game:GetService("Debris"):AddItem(GastGun,0)
    end
end)

1 answer

Log in to vote
0
Answered by
Puppynniko 1059 Moderation Voter
2 years ago

instead of using LaserType try making a if statement with whatever condition you want

Ad

Answer this question