Ad
Log in to vote
-2

How would I make this shoot lasers, and not balls?

Asked by 6 years ago

I'm trying to figure out on how to make this shoot neon-green lasers with neon-green pointlights. Can anyone help me edit this script, please? Also, the gun I'm using has 4 barrels. Here's the gun: http://www.roblox.com/Serious-Sam-XL-Laser-Rifle-W-I-P-item?id=155408531

And another thing, is if it's possible to make the lasers go through things named "Thin metal" or if the material is wood.

Tool = script.Parent

colors = {2, 0, 0}

function fire(v)

    Tool.Handle.Fire:play()


    local vCharacter = Tool.Parent
    local vPlayer = game.Players:playerFromCharacter(vCharacter)

    local missile = Instance.new("Part")



    local spawnPos = vCharacter.PrimaryPart.Position



    spawnPos  = spawnPos + (v * 8)

    missile.Position = spawnPos
    missile.Size = Vector3.new(1,1,1)
    missile.Velocity = v * 900
    missile.BrickColor = BrickColor.new(colors[math.random(1, #colors)])
    missile.Shape = 0
    missile.BottomSurface = 0
    missile.TopSurface = 0
    missile.Name = "Paintball"
    missile.Elasticity = 0
    missile.Reflectance = 0
    missile.Friction = .3

    local force = Instance.new("BodyForce")
    force.force = Vector3.new(0,100,0)
    force.Parent = missile

    Tool.BrickCleanup:clone().Parent = missile

    local new_script = script.Parent.Paintball:clone()
    new_script.Disabled = false
    new_script.Parent = missile

    local creator_tag = Instance.new("ObjectValue")
    creator_tag.Value = vPlayer
    creator_tag.Name = "creator"
    creator_tag.Parent = missile



    missile.Parent = game.Workspace
    --wait(0.05)
    --fire(


end


function check(en)
---------------------------------------Function start here.
if (Tool.Enabled == false) then
return false
end--end for if!
-------------------------------
if (Tool.Enabled == true) then
return true
end
---------------------------------------Function end here.
end


Tool.Enabled = true
function onActivated()

    if not Tool.Enabled then
        return
    end

    --Tool.Enabled = false

    local character = Tool.Parent;
    local humanoid = character.Humanoid
    if humanoid == nil then
        print("Humanoid not found")
        return 
    end

    local targetPos = humanoid.TargetPoint
    local lookAt = (targetPos - character.Head.Position).unit

    if (check()) then
    fire(lookAt)
    wait(0.001)
    onActivated()
    end
    return

    --Tool.Enabled = true
end


script.Parent.Activated:connect(onActivated)

2 answers

Log in to vote
0
Answered by 6 years ago

Your problem is that your shape is 0. ...

missile.Position = spawnPos
missile.Size = Vector3.new(1.2, 0.2, 0.2)
missile.Velocity = v * 900
missile.BrickColor = BrickColor.new(colors[math.random(1, #colors)])
missile.Shape = 1
missle.FormFactor = "Custom"
missile.BottomSurface = 0
missile.TopSurface = 0
missile.Name = "Paintball"
missile.Elasticity = 0
missile.Reflectance = 0
missile.Friction = .3
--missle.Transparency = .25

... The missle.Transparency makes it look more lasery...

Ad
Log in to vote
0
Answered by 6 years ago

You will need to use raycasting to create 'lasers'.

Here's the wiki link if you need to know how to use raycasting: Raycasting

0
I don't know how to use raycasting. TheRings0fSaturn 28 — 6y
0
That's why I provided a link for you to learn from. TheGuyWithAShortName 668 — 6y

Answer this question