Guest User

Untitled

a guest
Oct 23rd, 2014
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.94 KB | None | 0 0
  1. wait(1)
  2. local Tool = script.Parent;
  3. local pewsound
  4. local bangsound
  5. local cam
  6. local ggui
  7.  
  8. enabled = true
  9. automatichold = false
  10. dmged = false
  11. shotgun = false
  12. equipped = false
  13. overheated = false
  14. isZoom = false
  15.  
  16. -----------------------------------------ONLY EDIT THESE VALUES!!!!!-----------------------------------------
  17. -----!Instructions!-----
  18. --Make sure you have a part in the gun named Barrel, it is where the raycast will shoot from.--
  19. --Just place this script into any gun and edit the values below.--
  20. --Editting anything else will risk breaking it.--
  21. ------------------------
  22. Damage = math.random(15,25)
  23. SPS = 4 -- Shots Per Second, gives a limit of how fast the gun shoots.
  24. Recoil = 8 -- [1-10] [1 = Minigun, 10 = Sniper]
  25. WallShoot = false -- Shoots through walls.
  26. GH = false -- [True = RB can't hurt RB.] [False = RB can hurt RB.]
  27. BulletColor = "Bright orange" -- Any Brickcolor will work.
  28. Flash = false
  29. --------------------------------------------------------------------------------------------------------
  30.  
  31. local zm = Instance.new("Part")
  32. zm.Name = "ZoomZM"
  33. zm.Anchored = true
  34. zm.Transparency = 1
  35. zm.Size = Vector3.new(1,1,1)
  36. zm.CanCollide = false
  37. GunType = 0
  38.  
  39.  
  40.  function LaserShoot(mouse)
  41.     local function CreateVisuals(EndPos)
  42.         local Holder = Instance.new("Part", game.Workspace)
  43.         Holder.CanCollide = false
  44.         Holder.Transparency = 1
  45.         Holder.Anchored = true
  46.         Holder.CFrame = CFrame.new(EndPos)
  47.         local Fire = Instance.new("Fire", Holder)
  48.         -- Change the properties of fire to what you wish
  49.         local PointLight = Instance.new("PointLight",Holder)
  50.         -- Change the properties of the pointlight if you wish
  51.  
  52.         -- if you wish to remove after a while
  53.         game.Debris:AddItem(P,.1)
  54.     end
  55.  
  56.     hit = mouse.Hit.p
  57.     local StartPos = script.Parent.Barrel.CFrame.p
  58.     local rv = (StartPos-hit).magnitude/(Recoil * 20)
  59.     local rcl = Vector3.new(math.random(-rv,rv),math.random(-rv,rv),math.random(-rv,rv))
  60.     aim = hit + rcl
  61.     local P = Instance.new("Part")
  62.     P.Name = "Bullet"
  63.     P.formFactor = 3
  64.     P.BrickColor = BrickColor.new(BulletColor)
  65.     P.Size = Vector3.new(1,1,1)
  66.     P.Anchored = true
  67.     P.CanCollide = false
  68.     P.Transparency = 0.5
  69.     P.Parent = script.Parent.Parent
  70.     local m = Instance.new("CylinderMesh")
  71.     m.Name = "Mesh"
  72.     m.Parent = P
  73.     local c = Instance.new("ObjectValue")
  74.     c.Name = "creator"
  75.     c.Value = game.Players:findFirstChild(script.Parent.Parent.Name)
  76.     pewsound = Tool.Handle:FindFirstChild("Fire")
  77.     if pewsound then
  78.         pewsound:Play()
  79.     end --Brick created. Moving on to next part
  80.     local SPos = script.Parent.Barrel.CFrame.p
  81.     if WallShoot then
  82.         local Part1, Part2, EndPos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
  83.         DmgPlr(Part1)
  84.         DmgPlr(Part2)
  85.         CreateVisuals(EndPos)
  86.         if Part1 and Part2 then
  87.             local enddist = (EndPos-SPos).magnitude
  88.             P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-enddist/2) * CFrame.Angles(math.rad(90),0,0)
  89.             m.Scale = Vector3.new(.04,enddist,.04)
  90.         else
  91.             P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
  92.             m.Scale = Vector3.new(.04,MaxDist,.04)
  93.         end
  94.     elseif not WallShoot then
  95.         local Part, Pos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
  96.         DmgPlr(Part)
  97.         CreateVisuals(Pos)
  98.         if Part then
  99.             local dist = (Pos-SPos).magnitude
  100.             P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-dist/2) * CFrame.Angles(math.rad(90),0,0)
  101.             m.Scale = Vector3.new(.1,dist,.1)
  102.         else
  103.             P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
  104.             m.Scale = Vector3.new(.1,MaxDist,.1)
  105.         end
  106.         wait(0.2)
  107.     end
  108.     game.Debris:AddItem(P,.1)
  109. end
Advertisement
Add Comment
Please, Sign In to add comment