codemen

golden gun james bond script [roblox]

Nov 24th, 2017
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.13 KB | None | 0 0
  1. --nobody wanted to make a golden gun that I wanted... so I made one :D script made by sillynoob7
  2. function sandbox(var,func)
  3. local env = getfenv(func)
  4. local newenv = setmetatable({},{
  5. __index = function(self,k)
  6. if k=="script" then
  7. return var
  8. else
  9. return env[k]
  10. end
  11. end,
  12. })
  13. setfenv(func,newenv)
  14. return func
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. Tool0 = Instance.new("Tool")
  19. Part1 = Instance.new("Part")
  20. SpecialMesh2 = Instance.new("SpecialMesh")
  21. Part3 = Instance.new("Part")
  22. BillboardGui4 = Instance.new("BillboardGui")
  23. Script5 = Instance.new("Script")
  24. ImageLabel6 = Instance.new("ImageLabel")
  25. CylinderMesh7 = Instance.new("CylinderMesh")
  26. Part8 = Instance.new("Part")
  27. Weld9 = Instance.new("Weld")
  28. Weld10 = Instance.new("Weld")
  29. Weld11 = Instance.new("Weld")
  30. BlockMesh12 = Instance.new("BlockMesh")
  31. IntValue13 = Instance.new("IntValue")
  32. IntValue14 = Instance.new("IntValue")
  33. StringValue15 = Instance.new("StringValue")
  34. BoolValue16 = Instance.new("BoolValue")
  35. Script17 = Instance.new("Script")
  36. LocalScript18 = Instance.new("LocalScript")
  37. SpecialMesh19 = Instance.new("SpecialMesh")
  38. SpecialMesh20 = Instance.new("SpecialMesh")
  39. LocalScript21 = Instance.new("LocalScript")
  40. LocalScript22 = Instance.new("LocalScript")
  41. LocalScript23 = Instance.new("LocalScript")
  42. LocalScript24 = Instance.new("LocalScript")
  43. ScreenGui25 = Instance.new("ScreenGui")
  44. Frame26 = Instance.new("Frame")
  45. TextButton27 = Instance.new("TextButton")
  46. TextButton28 = Instance.new("TextButton")
  47. TextButton29 = Instance.new("TextButton")
  48. TextButton30 = Instance.new("TextButton")
  49. Script31 = Instance.new("Script")
  50. LocalScript32 = Instance.new("LocalScript")
  51. Sound33 = Instance.new("Sound")
  52. Sound34 = Instance.new("Sound")
  53. StringValue35 = Instance.new("StringValue")
  54. Tool0.Name = "Luger"
  55. Tool0.Parent = mas
  56. Part1.Parent = Tool0
  57. Part1.BrickColor = BrickColor.new("Bright bluish green")
  58. Part1.Anchored = true
  59. Part1.FormFactor = Enum.FormFactor.Custom
  60. Part1.Size = Vector3.new(0.510000467, 1.18000245, 1.34999704)
  61. Part1.CFrame = CFrame.new(6.70000076, 0.590013027, -9.69999599, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  62. Part1.Color = Color3.new(0, 0.560784, 0.611765)
  63. Part1.Position = Vector3.new(6.70000076, 0.590013027, -9.69999599)
  64. Part1.Color = Color3.new(0, 0.560784, 0.611765)
  65. SpecialMesh2.Parent = Part1
  66. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=95356090"
  67. SpecialMesh2.Scale = Vector3.new(1.79999995, 1.79999995, 1.79999995)
  68. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=126534866"
  69. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  70. SpecialMesh2.Scale = Vector3.new(1.79999995, 1.79999995, 1.79999995)
  71. Part3.Name = "Barrel"
  72. Part3.Parent = Tool0
  73. Part3.BrickColor = BrickColor.new("Really black")
  74. Part3.Transparency = 1
  75. Part3.Rotation = Vector3.new(-90, 0, 0)
  76. Part3.Anchored = true
  77. Part3.FormFactor = Enum.FormFactor.Custom
  78. Part3.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  79. Part3.CFrame = CFrame.new(6.79500008, 0.98001498, -10.4250021, 1, 0, -0, 0, 0, 1, 0, -1, 0)
  80. Part3.BottomSurface = Enum.SurfaceType.Smooth
  81. Part3.TopSurface = Enum.SurfaceType.Smooth
  82. Part3.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  83. Part3.Position = Vector3.new(6.79500008, 0.98001498, -10.4250021)
  84. Part3.Orientation = Vector3.new(-90, 0, 0)
  85. Part3.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  86. BillboardGui4.Name = "Light"
  87. BillboardGui4.Parent = Part3
  88. BillboardGui4.Size = UDim2.new(1.29999995, 0, 1.29999995, 0)
  89. BillboardGui4.Active = true
  90. BillboardGui4.Adornee = Part3
  91. Script5.Parent = BillboardGui4
  92. table.insert(cors,sandbox(Script5,function()
  93. script.Parent.Adornee = script.Parent.Parent
  94. end))
  95. ImageLabel6.Name = "Light"
  96. ImageLabel6.Parent = BillboardGui4
  97. ImageLabel6.Transparency = 1
  98. ImageLabel6.Size = UDim2.new(1, 0, 1, 0)
  99. ImageLabel6.Visible = false
  100. ImageLabel6.BackgroundColor3 = Color3.new(0.756863, 0.752941, 0.764706)
  101. ImageLabel6.BackgroundTransparency = 1
  102. ImageLabel6.Image = "http://www.roblox.com/asset/?id=42416376"
  103. CylinderMesh7.Parent = Part3
  104. CylinderMesh7.Scale = Vector3.new(0.9375, 0.0625, 0.62499994)
  105. CylinderMesh7.Scale = Vector3.new(0.9375, 0.0625, 0.62499994)
  106. Part8.Name = "Handle"
  107. Part8.Parent = Tool0
  108. Part8.BrickColor = BrickColor.new("Black")
  109. Part8.Transparency = 1
  110. Part8.Rotation = Vector3.new(0, 15, 0)
  111. Part8.Anchored = true
  112. Part8.FormFactor = Enum.FormFactor.Custom
  113. Part8.Size = Vector3.new(0.800000012, 0.800000012, 0.800000012)
  114. Part8.CFrame = CFrame.new(6.78499985, 0.468012989, -9.25, 0.965925634, -1.62808846e-07, 0.25881961, 1.62807055e-07, 1, 2.14409219e-08, -0.25881961, 2.14273292e-08, 0.965925634)
  115. Part8.BottomSurface = Enum.SurfaceType.Smooth
  116. Part8.TopSurface = Enum.SurfaceType.Smooth
  117. Part8.Color = Color3.new(0.105882, 0.164706, 0.207843)
  118. Part8.Position = Vector3.new(6.78499985, 0.468012989, -9.25)
  119. Part8.Orientation = Vector3.new(0, 15, 0)
  120. Part8.Color = Color3.new(0.105882, 0.164706, 0.207843)
  121. Weld9.Parent = Part8
  122. Weld9.C0 = CFrame.new(0, 0, 0, -1.00000191, -1.5067078e-06, -9.84804558e-08, -1.01587557e-06, 0.999997854, -2.52425416e-05, -8.14032717e-07, -2.34245799e-05, -0.999998748)
  123. Weld9.C1 = CFrame.new(0, 0, 0, -1.00000191, -1.5067078e-06, -9.84804558e-08, -1.01587557e-06, 0.999997854, -2.52425416e-05, -8.14032717e-07, -2.34245799e-05, -0.999998748)
  124. Weld9.Part0 = Part8
  125. Weld9.Part1 = Part8
  126. Weld10.Parent = Part8
  127. Weld10.C0 = CFrame.new(0, 0, 0, -1, -1.26128168e-06, 3.57787826e-07, -1.26129044e-06, 0.99999994, -2.43186951e-05, -3.57757187e-07, -2.42888927e-05, -0.99999994)
  128. Weld10.C1 = CFrame.new(0, 0, 0, -1, -1.26128168e-06, 3.57787826e-07, -1.26129044e-06, 0.99999994, -2.43186951e-05, -3.57757187e-07, -2.42888927e-05, -0.99999994)
  129. Weld10.Part0 = Part8
  130. Weld10.Part1 = Part8
  131. Weld11.Parent = Part8
  132. Weld11.C0 = CFrame.new(0, 0, 0, -0.000490181032, 0.999999642, 7.29662133e-07, 0.999998808, 0.000490319042, -0.000502735376, -0.00050124526, 4.34723916e-07, -0.999996543)
  133. Weld11.C1 = CFrame.new(0, 0, 0, -0.000490181032, 0.999999642, 7.29662133e-07, 0.999998808, 0.000490319042, -0.000502735376, -0.00050124526, 4.34723916e-07, -0.999996543)
  134. Weld11.Part0 = Part8
  135. Weld11.Part1 = Part8
  136. BlockMesh12.Parent = Part8
  137. BlockMesh12.Offset = Vector3.new(0, 0.00104166672, 0)
  138. BlockMesh12.Scale = Vector3.new(0.25, 0.0416666679, 0.0416666679)
  139. BlockMesh12.Scale = Vector3.new(0.25, 0.0416666679, 0.0416666679)
  140. IntValue13.Name = "Ammo"
  141. IntValue13.Parent = Tool0
  142. IntValue13.Value = 8
  143. IntValue14.Name = "MaxAmmo"
  144. IntValue14.Parent = Tool0
  145. IntValue14.Value = 8
  146. StringValue15.Name = "StringValue"
  147. StringValue15.Parent = Tool0
  148. BoolValue16.Name = "VisibleB"
  149. BoolValue16.Parent = Tool0
  150. Script17.Name = "WeldArm"
  151. Script17.Parent = Tool0
  152. table.insert(cors,sandbox(Script17,function()
  153. Tool = script.Parent
  154.  
  155.  
  156. local arms = nil
  157. local torso = nil
  158. local weld33 = nil -- right arm
  159. local weld55 = nil -- left arm
  160. local welds = {}
  161.  
  162.  
  163.  
  164.  
  165. colors = {26,}
  166.  
  167. function Equip(mouse)
  168. wait(0.01)
  169. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  170. torso = Tool.Parent:FindFirstChild("Torso")
  171. if arms ~= nil and torso ~= nil then
  172. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  173. if sh ~= nil then
  174. local yes = true
  175. if yes then
  176. yes = false
  177. sh[1].Part1 = nil
  178. sh[2].Part1 = nil
  179. local weld1 = Instance.new("Weld") -- left arm
  180. weld55 = weld1
  181. weld1.Part0 = torso
  182. weld1.Parent = torso
  183. weld1.Part1 = arms[1]
  184. weld1.C1 = CFrame.new(-0.35, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  185. welds[1] = weld1
  186. local weld2 = Instance.new("Weld") -- right arm
  187. weld33 = weld2
  188. weld2.Part0 = torso
  189. weld2.Parent = torso
  190. weld2.Part1 = arms[2]
  191. weld2.C1 = CFrame.new(-0.75, 0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  192. welds[2] = weld2
  193.  
  194. end
  195. else
  196. print("sh")
  197. end
  198. else
  199. print("arms")
  200. end
  201. end
  202.  
  203. function Unequip(mouse)
  204. if arms ~= nil and torso ~= nil then
  205. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  206. if sh ~= nil then
  207. local yes = true
  208. if yes then
  209. yes = false
  210. sh[1].Part1 = arms[1]
  211. sh[2].Part1 = arms[2]
  212. welds[1].Parent = nil
  213. welds[2].Parent = nil
  214.  
  215. end
  216. else
  217. print("sh")
  218. end
  219. else
  220. print("arms")
  221. end
  222. end
  223. Tool.Equipped:connect(Equip)
  224. Tool.Unequipped:connect(Unequip)
  225. end))
  226. LocalScript18.Name = "Arms"
  227. LocalScript18.Parent = Tool0
  228. table.insert(cors,sandbox(LocalScript18,function()
  229. sp = script.Parent
  230.  
  231. Mesh = false -- If true will load BC 2.0 Arm meshes as well.
  232. Shirt = true -- If true will load the user's shirt to the arms as well
  233.  
  234. function onEquipped(mouse)
  235. local Player = game:GetService("Players").LocalPlayer
  236. local Cam = game.Workspace.CurrentCamera
  237.  
  238. local Arms = Instance.new("Model")
  239. Arms.Name = "Arms"
  240. Arms.Parent = Cam
  241.  
  242. if Shirt == true then
  243. local Humanoid = Instance.new("Humanoid")
  244. Humanoid.MaxHealth = 0
  245. Humanoid.Health = 0
  246. Humanoid.Name = ""
  247. Humanoid.Parent = Arms
  248.  
  249. local newShirt = Player.Character:FindFirstChild("Shirt"):clone()
  250. newShirt.Parent = Arms
  251. else end
  252.  
  253. local RightArm = Player.Character:FindFirstChild("Right Arm"):clone()
  254. RightArm.Name = "Right Arm"
  255. RightArm.Transparency = 0.1
  256.  
  257. local w = Instance.new("Weld")
  258. w.Part0 = RightArm
  259. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  260. w.C0 = CFrame.new()
  261. w.C1 = CFrame.new()
  262. w.Parent = RightArm
  263. RightArm.Parent = Arms
  264.  
  265. local LeftArm = Player.Character:FindFirstChild("Left Arm"):clone()
  266. LeftArm.Name = "Left Arm"
  267. LeftArm.Transparency = 0.1
  268.  
  269. local w = Instance.new("Weld")
  270. w.Part0 = LeftArm
  271. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  272. w.C0 = CFrame.new()
  273. w.C1 = CFrame.new()
  274. w.Parent = LeftArm
  275. LeftArm.Parent = Arms
  276.  
  277. if Mesh ~= false then
  278. local LeftArmMesh = script:FindFirstChild("LeftArm")
  279. LeftArmMesh.Parent = LeftArm
  280. local RightArmMesh = script:FindFirstChild("RightArm")
  281. RightArmMesh.Parent = RightArm
  282. else end
  283.  
  284. end
  285.  
  286. function onUnequipped(mouse)
  287. local Player = game:GetService("Players").LocalPlayer
  288. local Cam = game.Workspace.CurrentCamera
  289. for _, Model in pairs(Cam:GetChildren()) do
  290. if Model.Name == "Arms" then
  291. Model:remove()
  292. else end
  293. end
  294. end
  295.  
  296. sp.Equipped:connect(onEquipped)
  297. sp.Unequipped:connect(onUnequipped)
  298.  
  299. end))
  300. SpecialMesh19.Name = "LeftArm"
  301. SpecialMesh19.Parent = LocalScript18
  302. SpecialMesh19.MeshId = "http://www.roblox.com/asset/?id=27111419"
  303. SpecialMesh19.MeshType = Enum.MeshType.FileMesh
  304. SpecialMesh20.Name = "RightArm"
  305. SpecialMesh20.Parent = LocalScript18
  306. SpecialMesh20.MeshId = "http://www.roblox.com/asset/?id=27111864"
  307. SpecialMesh20.MeshType = Enum.MeshType.FileMesh
  308. LocalScript21.Name = "BackupWeld"
  309. LocalScript21.Parent = Tool0
  310. table.insert(cors,sandbox(LocalScript21,function()
  311. function Weld(x,y)
  312. local W = Instance.new("Weld")
  313. W.Part0 = x
  314. W.Part1 = y
  315. local CJ = CFrame.new(x.Position)
  316. local C0 = x.CFrame:inverse()*CJ
  317. local C1 = y.CFrame:inverse()*CJ
  318. W.C0 = C0
  319. W.C1 = C1
  320. W.Parent = x
  321. end
  322.  
  323. function Get(A)
  324. if A.className == "Part" then
  325. Weld(script.Parent.Handle, A)
  326. A.Anchored = false
  327. else
  328. local C = A:GetChildren()
  329. for i=1, #C do
  330. Get(C[i])
  331. end
  332. end
  333. end
  334.  
  335. function Finale()
  336. Get(script.Parent)
  337. end
  338.  
  339. script.Parent.Equipped:connect(Finale)
  340. script.Parent.Unequipped:connect(Finale)
  341. Finale()
  342. end))
  343. LocalScript22.Name = "Crouch"
  344. LocalScript22.Parent = Tool0
  345. table.insert(cors,sandbox(LocalScript22,function()
  346. on = 0
  347. Tool = script.Parent
  348. welds = {}
  349. sh = {}
  350. arms = nil
  351. torso = nil
  352. f = nil
  353. function Crouch(ison)
  354. if arms == nil and torso == nil then
  355. arms = {Tool.Parent:FindFirstChild("Left Leg"), Tool.Parent:FindFirstChild("Right Leg")}
  356. torso = Tool.Parent:FindFirstChild("Torso")
  357. end
  358. if arms ~= nil and torso ~= nil then
  359. sh = {torso:FindFirstChild("Left Hip"), torso:FindFirstChild("Right Hip")}
  360. if sh ~= nil then
  361. local yes = true
  362. if yes then
  363. yes = false
  364. if ison == 1 then
  365. sh[1].Part1 = nil
  366. sh[2].Part1 = nil
  367. local weld1 = Instance.new("Weld")
  368. weld1.Part0 = torso
  369. weld1.Parent = torso
  370. weld1.Part1 = arms[1]
  371. weld1.C1 = CFrame.new(-0.5, 0.75, 1)
  372. arms[1].Name = "LDave"
  373. arms[1].CanCollide = true
  374. welds[1] = weld1
  375. Tool.Parent.Humanoid.WalkSpeed = 10
  376. -------------------------------------------
  377. local weld2 = Instance.new("Weld")
  378. weld2.Part0 = torso
  379. weld2.Parent = torso
  380. weld2.Part1 = arms[2]
  381. weld2.C1 = CFrame.new(0.5,0.495,1.25) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0)
  382. arms[2].Name = "RDave"
  383. arms[2].CanCollide = true
  384. welds[2] = weld2
  385. ---------------------------------
  386. local force = Instance.new("BodyForce")
  387. force.Parent = torso
  388. f = force
  389. wait(0.01)
  390. elseif ison == 0 then
  391. if arms then
  392. sh[1].Part1 = arms[1]
  393. sh[2].Part1 = arms[2]
  394. f.Parent = nil
  395. arms[2].Name = "Right Leg"
  396. arms[1].Name = "Left Leg"
  397. welds[1].Parent = nil
  398. welds[2].Parent = nil
  399. Tool.Parent.Humanoid.WalkSpeed = 16
  400. end
  401. end
  402. --
  403. end
  404. else
  405. print("sh")
  406. end
  407. else
  408. print("arms")
  409. end
  410. end
  411. function Key(key)
  412. if key then
  413. key = string.lower(key)
  414. if (key=="c") then
  415. if on == 1 then
  416. on = 0
  417. elseif on == 0 then
  418. on = 1
  419. end
  420. Crouch(on)
  421. end
  422. end
  423. end
  424. function Equip(mouse)
  425. mouse.KeyDown:connect(Key)
  426. end
  427. script.Parent.Equipped:connect(Equip)
  428.  
  429.  
  430. end))
  431. LocalScript23.Name = "Crouch/Patrol"
  432. LocalScript23.Parent = Tool0
  433. table.insert(cors,sandbox(LocalScript23,function()
  434. --Note this must be used with the accompanying weld script
  435. --This is an edited version of my V3 KeyCommand Script.
  436. --Heavily edited from a free model crouch script, ~ukwarrior6~
  437.  
  438. ----------------------------
  439. --Crouch and Patrol Script--
  440. ----------------------------
  441.  
  442. on = 0
  443. Tool = script.Parent
  444. welds = {}
  445. sh = {}
  446. arms = nil
  447. torso = nil
  448. f = nil
  449. Holstered = false
  450. wait()
  451. local Tool = script.Parent
  452. enabled = true
  453.  
  454. function Crouch(ison)
  455. if arms == nil and torso == nil then
  456. arms = {Tool.Parent:FindFirstChild("Left Leg"), Tool.Parent:FindFirstChild("Right Leg")}
  457. torso = Tool.Parent:FindFirstChild("Torso")
  458. end
  459. if arms ~= nil and torso ~= nil then
  460. sh = {torso:FindFirstChild("Left Hip"), torso:FindFirstChild("Right Hip")}
  461. if sh ~= nil then
  462. local yes = true
  463. if yes then
  464. yes = false
  465. if ison == 1 then
  466. sh[1].Part1 = nil
  467. sh[2].Part1 = nil
  468. local weld1 = Instance.new("Weld")
  469. weld1.Part0 = torso
  470. weld1.Parent = torso
  471. weld1.Part1 = arms[1]
  472. weld1.C1 = CFrame.new(-0.5, 0.75, 1)
  473. arms[1].Name = "LDave"
  474. arms[1].CanCollide = true
  475. welds[1] = weld1
  476. -------------------------------------------
  477. local weld2 = Instance.new("Weld")
  478. weld2.Part0 = torso
  479. weld2.Parent = torso
  480. weld2.Part1 = arms[2]
  481. weld2.C1 = CFrame.new(0.5,0.495,1.25) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0)
  482. arms[2].Name = "RDave"
  483. arms[2].CanCollide = true
  484. welds[2] = weld2
  485. ---------------------------------
  486. local force = Instance.new("BodyForce")
  487. force.Parent = torso
  488. f = force
  489. wait(0.01)
  490. elseif ison == 0 then
  491. if arms then
  492. sh[1].Part1 = arms[1]
  493. sh[2].Part1 = arms[2]
  494. f.Parent = nil
  495. arms[2].Name = "Right Leg"
  496. arms[1].Name = "Left Leg"
  497. welds[1].Parent = nil
  498. welds[2].Parent = nil
  499. end
  500. end
  501. --
  502. end
  503. else
  504. print("sh")
  505. end
  506. else
  507. print("arms")
  508. end
  509. end
  510. ----------------------------------------------------------------------------------------------------------------
  511. function GunUp()
  512. Holstered = false
  513. Tool.Enabled = true
  514. torso = Tool.Parent:FindFirstChild("Torso")
  515. if torso ~= nil then
  516. torso.weld1.C1 = CFrame.new(0.7, 0.9, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(28), math.rad(-1))
  517. torso.weld2.C1 = CFrame.new(-0.6, 0, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-0.01), 0)
  518. end
  519. end
  520.  
  521. function GunDown()
  522. Holstered = true
  523. Tool.Enabled = false -- You don't want to be shooting if your not aiming
  524. torso = Tool.Parent:FindFirstChild("Torso")
  525. if torso ~= nil then
  526. torso.weld1.C1 = CFrame.new(0.5,0,.5) * CFrame.fromEulerAnglesXYZ(math.rad(315), 0, math.rad(-40))
  527. torso.weld2.C1 = CFrame.new(-.8, -0.6, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-40), math.rad(-60), 0)
  528. end
  529. end
  530. -----------------------------------------------------------------------------------------------------------------
  531. function onEquippedLocal(mouse)
  532. mouse.Icon = "" -- Chuck in a cool crosshair here..
  533. mouse.KeyDown:connect(onKeyDown)
  534. end
  535. -----------------------------------------------------------------------------------------------------------------
  536. function onKeyDown(key)
  537. if (key~=nil) then
  538. key = key:lower()
  539.  
  540. if (key=="c") then -- Toggle Crouch (For some reason it breaks if you patrol first, working on this...
  541. if on == 1 then
  542. on = 0
  543. elseif on == 0 then
  544. on = 1
  545. end
  546. Crouch(on)
  547.  
  548. elseif (key=="e") then -- Toggle Patrol
  549. if Holstered == true then
  550. script.Parent.Parent.Humanoid.WalkSpeed = 16
  551. GunUp()
  552. elseif Holstered == false then
  553. script.Parent.Parent.Humanoid.WalkSpeed = 20
  554. GunDown()
  555. end end end end
  556. Tool.Equipped:connect(onEquippedLocal)
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563. end))
  564. LocalScript24.Name = "GuiScript"
  565. LocalScript24.Parent = Tool0
  566. table.insert(cors,sandbox(LocalScript24,function()
  567. local Tool = script.Parent
  568.  
  569. local vPlayer
  570. local Gui
  571. local Alt
  572. local Coords
  573. local Ammo
  574. local ready = false
  575.  
  576.  
  577. function setUpGui()
  578. if vPlayer == nil or vPlayer:findFirstChild("PlayerGui") == nil then
  579. return
  580. end
  581.  
  582. Gui = script.ScreenGui:Clone()
  583. Gui.Name = "GunDisplay"
  584. Gui.Parent = vPlayer.PlayerGui
  585. end
  586.  
  587. function onEquippedLocal(mouse)
  588. vPlayer = game.Players.LocalPlayer
  589.  
  590. setUpGui()
  591. ready = false
  592. end
  593.  
  594. function onUnequippedLocal(mouse)
  595. if Gui then
  596. Gui:remove()
  597. end
  598.  
  599. Gui = nil
  600. Alt = nil
  601. Coords = nil
  602. Ammo = nil
  603. vPlayer = nil
  604. end
  605.  
  606. Tool.Equipped:connect(onEquippedLocal)
  607. Tool.Unequipped:connect(onUnequippedLocal)
  608.  
  609. while true do
  610. wait()
  611. if Gui then
  612. Gui.Stats.Mode.Text = "Mode: " ..script.Parent.ModeText.Value
  613. Gui.Stats.Ammo.Ammo.Text = ""..math.floor((((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100)).."%"
  614. Gui.Stats.Reload.Text = script.Parent.StringValue.Value
  615. if script.Parent.VisibleB.Value then
  616. Gui.Stats.Reload.Visible = true
  617. else
  618. Gui.Stats.Reload.Visible = false
  619. end
  620. if (((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100) > 66 then
  621. Gui.Stats.Ammo.Ammo.TextColor3 = Color3.new(-0,-128,-0)
  622. elseif (((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100) > 33 then
  623. Gui.Stats.Ammo.Ammo.TextColor3 = Color3.new(-255,-255,-102)
  624. elseif (((script.Parent.Ammo.Value / script.Parent.MaxAmmo.Value)) * 100) > 0 then
  625. Gui.Stats.Ammo.Ammo.TextColor3 = Color3.new(-255,-51,-0)
  626. end
  627.  
  628. end
  629. end
  630.  
  631. end))
  632. ScreenGui25.Parent = LocalScript24
  633. Frame26.Name = "Stats"
  634. Frame26.Parent = ScreenGui25
  635. Frame26.Transparency = 1
  636. Frame26.Size = UDim2.new(0.200000003, 0, 0.100000001, 0)
  637. Frame26.Position = UDim2.new(0.100000001, 0, 0.649999976, 0)
  638. Frame26.BackgroundTransparency = 1
  639. TextButton27.Name = "Mode"
  640. TextButton27.Parent = Frame26
  641. TextButton27.Transparency = 1
  642. TextButton27.Size = UDim2.new(1, 0, 0.5, 0)
  643. TextButton27.Text = "Mode: Nil"
  644. TextButton27.BackgroundTransparency = 1
  645. TextButton27.Font = Enum.Font.ArialBold
  646. TextButton27.FontSize = Enum.FontSize.Size18
  647. TextButton27.TextColor3 = Color3.new(0.866667, 0.866667, 0.866667)
  648. TextButton28.Name = "Ammo"
  649. TextButton28.Parent = Frame26
  650. TextButton28.Transparency = 1
  651. TextButton28.Size = UDim2.new(1, 0, 0.5, 0)
  652. TextButton28.Text = "Ammo: "
  653. TextButton28.Position = UDim2.new(-0.119999997, 0, 0.5, 0)
  654. TextButton28.BackgroundTransparency = 1
  655. TextButton28.Font = Enum.Font.ArialBold
  656. TextButton28.FontSize = Enum.FontSize.Size18
  657. TextButton28.TextColor3 = Color3.new(0.866667, 0.866667, 0.866667)
  658. TextButton29.Name = "Ammo"
  659. TextButton29.Parent = TextButton28
  660. TextButton29.Transparency = 1
  661. TextButton29.Size = UDim2.new(1, 0, 1, 0)
  662. TextButton29.Text = "90%"
  663. TextButton29.Position = UDim2.new(0.699999988, 0, 0, 0)
  664. TextButton29.BackgroundTransparency = 1
  665. TextButton29.Font = Enum.Font.ArialBold
  666. TextButton29.FontSize = Enum.FontSize.Size18
  667. TextButton29.TextColor3 = Color3.new(1, 0.2, 0)
  668. TextButton29.TextXAlignment = Enum.TextXAlignment.Left
  669. TextButton30.Name = "Reload"
  670. TextButton30.Parent = Frame26
  671. TextButton30.Transparency = 1
  672. TextButton30.Size = UDim2.new(1, 0, 0.5, 0)
  673. TextButton30.Text = "Reloading"
  674. TextButton30.Position = UDim2.new(0, 0, 1, 0)
  675. TextButton30.Visible = false
  676. TextButton30.BackgroundTransparency = 1
  677. TextButton30.Font = Enum.Font.ArialBold
  678. TextButton30.FontSize = Enum.FontSize.Size18
  679. TextButton30.TextColor3 = Color3.new(1, 0.2, 0)
  680. TextButton30.TextTransparency = 1.8000003099442
  681. Script31.Name = "Flash"
  682. Script31.Parent = TextButton30
  683. table.insert(cors,sandbox(Script31,function()
  684. while true do wait()
  685. for i=1,5 do
  686. script.Parent.TextTransparency = script.Parent.TextTransparency + 0.1
  687. wait(0.05)
  688. end
  689. wait(0.1)
  690. for i=1,5 do
  691. script.Parent.TextTransparency = script.Parent.TextTransparency - 0.1
  692. wait(0.05)
  693. end
  694. end
  695.  
  696. end))
  697. LocalScript32.Name = "MainScript"
  698. LocalScript32.Parent = Tool0
  699. table.insert(cors,sandbox(LocalScript32,function()
  700. wait(1)
  701. local Tool = script.Parent;
  702. local pewsound
  703. local bangsound
  704. local cam
  705. local ggui
  706.  
  707. enabled = true
  708. automatichold = false
  709. dmged = false
  710. shotgun = false
  711. equipped = false
  712. overheated = false
  713. isZoom = false
  714.  
  715. -----------------------------------------ONLY EDIT THESE VALUES!!!!!-----------------------------------------
  716. -----!Instructions!-----
  717. --Make sure you have a part in the gun named Barrel, it is where the raycast will shoot from.--
  718. --Just place this script into any gun and edit the values below.--
  719. --Editting anything else will risk breaking it.--
  720. ------------------------
  721. Damage = 20
  722. SPS = 15 -- Shots Per Second, gives a limit of how fast the gun shoots.
  723. Recoil = 3 -- [1-10] [1 = Minigun, 10 = Sniper]
  724. WallShoot = false -- Shoots through walls.
  725. GH = false -- [True = RB can't hurt RB.] [False = RB can hurt RB.]
  726. BulletColor = "Cool yellow" -- Any Brickcolor will work.
  727. Flash = true
  728. --------------------------------------------------------------------------------------------------------
  729.  
  730. local zm = Instance.new("Part")
  731. zm.Name = "ZoomZM"
  732. zm.Anchored = true
  733. zm.Transparency = 1
  734. zm.Size = Vector3.new(1,1,1)
  735. zm.CanCollide = false
  736. GunType = 0
  737.  
  738. --[[local gui = Instance.new("ScreenGui")
  739. local bg = Instance.new("Frame",gui)
  740. local bar = Instance.new("Frame",bg)
  741. local bvl = Instance.new("ImageLabel", bg)
  742. bvl.Name = "Bevel"
  743. bvl.BackgroundTransparency = 1
  744. bvl.Image = "http://www.roblox.com/asset/?id=56852431"
  745. bvl.Size = UDim2.new(1,0,1,0)
  746. bg.Name = "Back"
  747. bar.Name = "Charge"
  748. bar.BackgroundColor3 = Color3.new(200/255,0/255,0/255)
  749. bg.BackgroundColor3 = Color3.new(200/255,200/255,200/255)
  750. bg.Size = UDim2.new(0,10,0,-100)
  751. bg.Position = UDim2.new(0,5,0,500)
  752. bar.Size = UDim2.new(0,4,-1,0)
  753. bar.Position = UDim2.new(0,3,1,0)
  754.  
  755. ggui = gui:Clone()
  756. ggui.Name = "GunGui"
  757. ggui.Back.Charge.Size = UDim2.new(0,4,-(script.Charge.Value/100),0)]]
  758.  
  759. GroupID = 9999
  760.  
  761. function AntiGH(char1,char2)
  762. if GH then
  763. local plyr1 = game.Players:findFirstChild(char1.Name)
  764. local plyr2 = game.Players:findFirstChild(char2.Name)
  765. if plyr1 and plyr2 then
  766. if plyr1:IsInGroup(GroupID) and plyr2:IsInGroup(GroupID) then
  767. return false
  768. end
  769. end
  770. return true
  771. elseif not GH then
  772. return true
  773. end
  774. end
  775.  
  776. MaxDist = 1000
  777.  
  778. function RayCast(Start,End,Ignore)
  779. if WallShoot then
  780. ray1 = Ray.new(Start, End.unit * 999.999)
  781. local Part1, TempPos = Workspace:FindPartOnRay(ray1,Ignore)
  782. ray2 = Ray.new(TempPos, End.unit * 999.999)
  783. local Part2, EndPos = Workspace:FindPartOnRay(ray2,Part1)
  784. return Part1, Part2, EndPos
  785. elseif not WallShoot then
  786. ray = Ray.new(Start, End.unit * 999.999)
  787. return Workspace:FindPartOnRay(ray,Ignore)
  788. end
  789. end
  790.  
  791. function DmgPlr(Part)
  792. if Part ~= nil then
  793. local c = Instance.new("ObjectValue")
  794. c.Name = "creator"
  795. c.Value = game.Players:findFirstChild(script.Parent.Parent.Name)
  796. local hum = Part.Parent:findFirstChild("Humanoid")
  797. local hathum = Part.Parent.Parent:findFirstChild("Humanoid")
  798. local hat = Part.Parent
  799. if hathum ~= nil and hat:IsA("Hat") and AntiGH(hathum.Parent, script.Parent.Parent) then
  800. hathum:TakeDamage(Damage/1)
  801. Part.Parent = game.Workspace
  802. Part.CFrame = CFrame.new(Part.Position + Vector3.new(math.random(-5,5),math.random(-5,5),math.random(-5,5)))
  803. hat:Remove()
  804. c.Parent = hathum
  805. game.Debris:AddItem(c,1.5)
  806. elseif hum ~= nil and AntiGH(hum.Parent, script.Parent.Parent) then
  807. if Part.Name == "Head" then
  808. hum:TakeDamage(Damage*1.3)
  809. end
  810. hum:TakeDamage(Damage)
  811. c.Parent = hum
  812. game.Debris:AddItem(c,1.5)
  813. end
  814. end
  815. end
  816.  
  817. function onButton1Down(mouse)
  818. if script.Parent.Ammo.Value == 0 then
  819. else
  820. if GunType == 0 then
  821. if (not enabled) then return end
  822. enabled = false
  823. LaserShoot(mouse)
  824. if Flash then
  825. script.Parent.Barrel.Light.Light.Visible = true
  826. end
  827. script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
  828. wait(0.01)
  829. if Flash then
  830. script.Parent.Barrel.Light.Light.Visible = false
  831. end
  832. wait(1/SPS)
  833. enabled = true
  834. elseif GunType == 1 then
  835. automatichold = true
  836. while automatichold == true and script.Parent.Ammo.Value ~= 0 do wait()
  837. if (not enabled) then return end
  838. if script.Parent.Parent:findFirstChild("Humanoid").Health == 0 then script.Parent:Remove() end
  839. enabled = false
  840. LaserShoot(mouse)
  841. if Flash then
  842. script.Parent.Barrel.Light.Light.Visible = true
  843. end
  844. script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
  845. wait(0.01)
  846. if Flash then
  847. script.Parent.Barrel.Light.Light.Visible = false
  848. end
  849. wait(1/SPS)
  850. enabled = true
  851. end
  852. end
  853. end
  854. end
  855.  
  856. function LaserShoot(mouse)
  857. hit = mouse.Hit.p
  858. local StartPos = script.Parent.Barrel.CFrame.p
  859. local rv = (StartPos-hit).magnitude/(Recoil * 20)
  860. local rcl = Vector3.new(math.random(-rv,rv),math.random(-rv,rv),math.random(-rv,rv))
  861. aim = hit + rcl
  862. local P = Instance.new("Part")
  863. P.Name = "Bullet"
  864. P.formFactor = 3
  865. P.BrickColor = BrickColor.new(BulletColor)
  866. P.Size = Vector3.new(1,1,1)
  867. P.Anchored = true
  868. P.CanCollide = false
  869. P.Transparency = 0.5
  870. P.Parent = script.Parent.Parent
  871. local m = Instance.new("CylinderMesh")
  872. m.Name = "Mesh"
  873. m.Parent = P
  874. local c = Instance.new("ObjectValue")
  875. c.Name = "creator"
  876. c.Value = game.Players:findFirstChild(script.Parent.Parent.Name)
  877. pewsound = script:FindFirstChild("Fire")
  878. if pewsound then
  879. pewsound:Play()
  880. end --Brick created. Moving on to next part
  881. local SPos = script.Parent.Barrel.CFrame.p
  882. if WallShoot then
  883. local Part1, Part2, EndPos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
  884. DmgPlr(Part1)
  885. DmgPlr(Part2)
  886. if Part1 and Part2 then
  887. local enddist = (EndPos-SPos).magnitude
  888. P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-enddist/2) * CFrame.Angles(math.rad(90),0,0)
  889. m.Scale = Vector3.new(.04,enddist,.04)
  890. else
  891. P.CFrame = CFrame.new(EndPos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
  892. m.Scale = Vector3.new(.04,MaxDist,.04)
  893. end
  894. elseif not WallShoot then
  895. local Part, Pos = RayCast(SPos, (aim-SPos).unit * 999, script.Parent.Parent)
  896. DmgPlr(Part)
  897. if Part then
  898. local dist = (Pos-SPos).magnitude
  899. P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-dist/2) * CFrame.Angles(math.rad(90),0,0)
  900. m.Scale = Vector3.new(.1,dist,.1)
  901. else
  902. P.CFrame = CFrame.new(Pos, SPos) * CFrame.new(0,0,-MaxDist/2) * CFrame.Angles(math.rad(90),0,0)
  903. m.Scale = Vector3.new(.1,MaxDist,.1)
  904. end
  905. end
  906. game.Debris:AddItem(P,.1)
  907. end
  908.  
  909. function onButton1Up(mouse)
  910. automatichold = false
  911. end
  912.  
  913. function onKeyDown(key, mouse)
  914.  
  915.  
  916.  
  917. if key:lower() == "r" then
  918. if script.Parent.Ammo.Value ~= script.Parent.MaxAmmo.Value then
  919. reloadsound = script:FindFirstChild("Reload")
  920. if reloadsound then
  921. reloadsound:Play()
  922. end
  923. enabled = false
  924. script.Parent.VisibleB.Value = true
  925. script.Parent.StringValue.Value = "Reloading"
  926. repeat script.Parent.StringValue.Value = "Reloading" wait(0.3) script.Parent.Ammo.Value = script.Parent.Ammo.Value + 3 script.Parent.StringValue.Value = "Reloading" until script.Parent.Ammo.Value >= script.Parent.MaxAmmo.Value
  927. script.Parent.Ammo.Value = script.Parent.MaxAmmo.Value
  928. wait(0.2)
  929. script.Parent.VisibleB.Value = false
  930. enabled = true
  931. end
  932. end
  933.  
  934. if key:lower() == "m" then
  935. if GunType == 0 then
  936. GunType = 0
  937. Recoil = 3
  938. else
  939. GunType = 1
  940. Recoil = 3
  941. end
  942. end
  943.  
  944. end
  945.  
  946. function onEquipped(mouse)
  947. equipped = true
  948.  
  949. if mouse == nil then
  950. print("Mouse not found")
  951. return
  952. end
  953. mouse.Icon = "http://www.roblox.com/asset/?id=52812029"
  954. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  955. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  956. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  957.  
  958. end
  959.  
  960. function onUnequipped(mouse)
  961. equipped = false
  962. automatichold = false
  963.  
  964.  
  965. end
  966.  
  967. script.Parent.Equipped:connect(onEquipped)
  968. script.Parent.Unequipped:connect(onUnequipped)
  969. while true do wait()
  970. if script.Parent.Ammo.Value == 0 then
  971. script.Parent.VisibleB.Value = true
  972. script.Parent.StringValue.Value = "Reload"
  973. end
  974. if GunType == 1 then
  975. script.Parent.ModeText.Value = "Auto"
  976. else
  977. script.Parent.ModeText.Value = "Semi"
  978. end
  979. end
  980.  
  981.  
  982. end))
  983. Sound33.Name = "Fire"
  984. Sound33.Parent = LocalScript32
  985. Sound33.SoundId = "http://roblox.com/asset/?id=519174837"
  986. Sound33.Volume = 1
  987. Sound34.Name = "Reload"
  988. Sound34.Parent = LocalScript32
  989. Sound34.SoundId = "http://www.roblox.com/asset/?id=519174837"
  990. Sound34.Volume = 1
  991. Sound34.PlayOnRemove = true
  992. StringValue35.Name = "ModeText"
  993. StringValue35.Parent = Tool0
  994. StringValue35.Value = "Nil"
  995. for i,v in pairs(mas:GetChildren()) do
  996. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  997. pcall(function() v:MakeJoints() end)
  998. end
  999. mas:Destroy()
  1000. for i,v in pairs(cors) do
  1001. spawn(function()
  1002. pcall(v)
  1003. end)
  1004. end
Add Comment
Please, Sign In to add comment