Advertisement
BINO2002

Untitled

Apr 3rd, 2016
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.29 KB | None | 0 0
  1. --[[
  2. Flare Gun
  3. A red flare gun.
  4. --]]
  5.  
  6.  
  7. if script == nil then return end
  8.  
  9.  
  10. ModelName = "Flare Gun"
  11. AmmoType = "Flare Grenades"
  12. MagazineCapacity = 1
  13. MagazineCapacityAdd = 0
  14. Color = Color3.new(1, 0, 0)
  15. Player = Game:GetService("Players").LocalPlayer
  16. Char = Player.Character
  17. animate = Char:findFirstChild("Animate")
  18. if animate then
  19. animate:Destroy()
  20. end
  21.  
  22. Selected = false
  23. Connected = false
  24. Button1Down = false
  25. CanUse = true
  26.  
  27. function CheckPlayer()
  28. if Player.Character == nil then return false end
  29. if Player.Character:FindFirstChild("Torso") == nil or Player.Character:FindFirstChild("Right Arm") == nil or Player.Character:FindFirstChild("Left Arm") == nil or Player.Character:FindFirstChild("Humanoid") == nil then return false end
  30. if Player.Character.Humanoid.Health <= 0 then return false end
  31. return true
  32. end
  33.  
  34.  
  35. function tagHumanoid(humanoid)
  36. local tag = Instance.new("ObjectValue")
  37. tag.Name = "creator"
  38. tag.Value = Player
  39. tag.Parent = humanoid
  40. end
  41.  
  42.  
  43. function untagHumanoid(humanoid)
  44. if humanoid ~= nil then
  45. local tag = humanoid:FindFirstChild("creator")
  46. if tag ~= nil then
  47. tag:Remove()
  48. end
  49. end
  50. end
  51.  
  52.  
  53. --[[
  54. CameraPunch v5
  55.  
  56. Functions:
  57. CameraPunch
  58. CameraSlide
  59. --]]
  60.  
  61.  
  62. function CameraPunch(X, Y)
  63. X, Y = X or math.rad(10), Y or math.rad(math.random(-10000, 10000) / 1000)
  64. Workspace.CurrentCamera.CoordinateFrame =
  65. CFrame.new(Workspace.CurrentCamera.Focus.p) *
  66. CFrame.fromEulerAnglesXYZ(CFrame.new(Workspace.CurrentCamera.CoordinateFrame.p, Workspace.CurrentCamera.Focus.p):toEulerAnglesXYZ()) *
  67. CFrame.fromEulerAnglesXYZ(X, Y, 0) *
  68. CFrame.new(0, 0, (Workspace.CurrentCamera.CoordinateFrame.p - Workspace.CurrentCamera.Focus.p).magnitude)
  69. end
  70.  
  71.  
  72. function CameraSlide(X, Y, Step)
  73. X, Y, Step = X or math.rad(10), Y or math.rad(math.random(-10000, 10000) / 1000), Step or 0.1
  74. for i = 0, 1, Step do
  75. CameraPunch(Step * X, Step * Y)
  76. wait()
  77. end
  78. end
  79.  
  80.  
  81. SoundToServer = function(Name, SoundId, Pitch, Volume, Looped, Parent)
  82. local Sound = Instance.new("Sound")
  83. Sound.Name = Name
  84. Sound.SoundId = SoundId
  85. Sound.Pitch = Pitch
  86. Sound.Volume = Volume
  87. Sound.Looped = Looped
  88. Sound.Parent = Parent
  89. Sound:Play()
  90. end
  91.  
  92.  
  93. function CreateParts(Parent, Format)
  94. if Parent == nil then return end
  95. local Parts = Instance.new("Model")
  96. Parts.Name = ModelName
  97. if Format == 1 then
  98. Parts.Name = Parts.Name.. " (Holstered)"
  99. end
  100. Parts.Parent = Parent
  101.  
  102. local MasterPart = Instance.new("Part")
  103. MasterPart.Material = "SmoothPlastic"
  104. MasterPart.Name = "Handle"
  105. MasterPart.BrickColor = BrickColor.new(Color)
  106. MasterPart.TopSurface = 0
  107. MasterPart.BottomSurface = 0
  108. MasterPart.FormFactor = "Custom"
  109. MasterPart.Size = Vector3.new(0.3, 0.4, 0.35)
  110. MasterPart.Parent = Parts
  111. local Weld = Instance.new("Weld")
  112. Weld.Part0 = MasterPart
  113. if Format == 1 then
  114. Weld.Part1 = Player.Character:FindFirstChild("Right Arm")
  115. Weld.C1 = CFrame.new(0.6, 0.4, 0)
  116. elseif Format == 2 then
  117. Weld.Part1 = Player.Character:FindFirstChild("Right Arm")
  118. Weld.C1 = CFrame.new(0, -1.1, -0.3)
  119. end
  120. Weld.Parent = Weld.Part0
  121.  
  122. local Part = Instance.new("Part")
  123. Part.Material = "SmoothPlastic"
  124. Part.Name = "Trigger 1"
  125. Part.BrickColor = BrickColor.new(Color)
  126. Part.TopSurface = 0
  127. Part.BottomSurface = 0
  128. Part.FormFactor = "Custom"
  129. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  130. Part.Parent = Parts
  131. local Weld = Instance.new("Weld")
  132. Weld.Part0 = Part
  133. Weld.Part1 = MasterPart
  134. Weld.C0 = CFrame.new(0, 0.3, -0.075)
  135. Weld.Parent = Weld.Part0
  136. local Mesh = Instance.new("SpecialMesh", Part)
  137. Mesh.MeshType = "Brick"
  138. Mesh.Scale = Vector3.new(0.05 / 0.2, 0.01 / 0.2, 0.1 / 0.2)
  139.  
  140. local Part = Instance.new("Part")
  141. Part.Material = "SmoothPlastic"
  142. Part.Name = "Trigger Guard"
  143. Part.BrickColor = BrickColor.new(Color)
  144. Part.TopSurface = 0
  145. Part.BottomSurface = 0
  146. Part.FormFactor = "Custom"
  147. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  148. Part.Parent = Parts
  149. local Weld = Instance.new("Weld")
  150. Weld.Part0 = Part
  151. Weld.Part1 = MasterPart
  152. Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  153. Weld.C1 = CFrame.new(0, -0.3, 0.1)
  154. Weld.Parent = Weld.Part0
  155. local Mesh = Instance.new("SpecialMesh", Part)
  156. Mesh.MeshType = "FileMesh"
  157. Mesh.MeshId = "http://www.roblox.com/Asset/?id=3270017"
  158. Mesh.Scale = Vector3.new(0.25, 0.3, 0.4)
  159.  
  160. local Part = Instance.new("Part")
  161. Part.Material = "SmoothPlastic"
  162. Part.Name = "Grip 1"
  163. Part.BrickColor = BrickColor.new(Color)
  164. Part.TopSurface = 0
  165. Part.BottomSurface = 0
  166. Part.FormFactor = "Custom"
  167. Part.Size = Vector3.new(0.29, 0.35, 0.7)
  168. Part.Locked = true
  169. Part.Parent = Parts
  170. local Weld = Instance.new("Weld")
  171. Weld.Part0 = Part
  172. Weld.Part1 = MasterPart
  173. Weld.C0 = CFrame.new(0, 0, -0.4) * CFrame.fromEulerAnglesXYZ(math.rad(20), 0, 0)
  174. Weld.Parent = Weld.Part0
  175.  
  176. local Part = Instance.new("Part")
  177. Part.Material = "SmoothPlastic"
  178. Part.Name = "Grip 2"
  179. Part.BrickColor = BrickColor.new("White")
  180. Part.TopSurface = 0
  181. Part.BottomSurface = 0
  182. Part.FormFactor = "Custom"
  183. Part.Size = Vector3.new(0.31, 0.25, 0.6)
  184. Part.Locked = true
  185. Part.Parent = Parts
  186. local Weld = Instance.new("Weld")
  187. Weld.Part0 = Part
  188. Weld.Part1 = MasterPart
  189. Weld.C0 = CFrame.new(0, 0, -0.4) * CFrame.fromEulerAnglesXYZ(math.rad(20), 0, 0)
  190. Weld.Parent = Weld.Part0
  191.  
  192. local Part = Instance.new("WedgePart")
  193. Part.Material = "SmoothPlastic"
  194. Part.Name = "Handle Body 1"
  195. Part.BrickColor = BrickColor.new(Color)
  196. Part.TopSurface = 0
  197. Part.BottomSurface = 0
  198. Part.FormFactor = "Custom"
  199. Part.Size = Vector3.new(0.3, 0.4, 0.2)
  200. Part.Parent = Parts
  201. local Weld = Instance.new("Weld")
  202. Weld.Part0 = Part
  203. Weld.Part1 = MasterPart
  204. Weld.C0 = CFrame.new(0, 0, 0.25)
  205. Weld.Parent = Weld.Part0
  206. local Mesh = Instance.new("SpecialMesh", Part)
  207. Mesh.MeshType = "Wedge"
  208. Mesh.Scale = Vector3.new(1, 1, 0.15 / 0.2)
  209.  
  210. local Part = Instance.new("Part")
  211. Part.Material = "SmoothPlastic"
  212. Part.Name = "Handle Body 2"
  213. Part.BrickColor = BrickColor.new(Color)
  214. Part.TopSurface = 0
  215. Part.BottomSurface = 0
  216. Part.FormFactor = "Custom"
  217. Part.Size = Vector3.new(0.3, 0.2, 0.35)
  218. Part.Locked = true
  219. Part.Parent = Parts
  220. local Weld = Instance.new("Weld")
  221. Weld.Part0 = Part
  222. Weld.Part1 = MasterPart
  223. Weld.C0 = CFrame.new(0, 0.225, 0.15)
  224. Weld.Parent = Weld.Part0
  225. local Mesh = Instance.new("SpecialMesh", Part)
  226. Mesh.MeshType = "Brick"
  227. Mesh.Scale = Vector3.new(1, 0.05 / 0.2, 1)
  228.  
  229. local Part = Instance.new("Part")
  230. Part.Name = "Handle Body 3"
  231. Part.BrickColor = BrickColor.new(Color)
  232. Part.TopSurface = 0
  233. Part.BottomSurface = 0
  234. Part.FormFactor = "Custom"
  235. Part.Size = Vector3.new(0.3, 1, 0.2)
  236. Part.Parent = Parts
  237. local Weld = Instance.new("Weld")
  238. Part.Material = "SmoothPlastic"
  239. Weld.Part0 = Part
  240. Weld.Part1 = MasterPart
  241. Weld.C0 = CFrame.new(0, 0.75, 0.075)
  242. Weld.Parent = Weld.Part0
  243.  
  244. local Part = Instance.new("Part")
  245. Part.Material = "SmoothPlastic"
  246. Part.Name = "Barrel"
  247. Part.BrickColor = BrickColor.new(Color)
  248. Part.TopSurface = 0
  249. Part.BottomSurface = 0
  250. Part.FormFactor = "Custom"
  251. Part.Size = Vector3.new(0.4, 1, 0.4)
  252. Part.Parent = Parts
  253. local Weld = Instance.new("Weld")
  254. Weld.Part0 = Part
  255. Weld.Part1 = MasterPart
  256. Weld.C0 = CFrame.new(0, 0.75, 0.2)
  257. Weld.Parent = Weld.Part0
  258. Instance.new("CylinderMesh", Part)
  259.  
  260. local Part = Instance.new("Part")
  261. Part.Material = "SmoothPlastic"
  262. Part.Name = "Barrel Hole"
  263. Part.BrickColor = BrickColor.new("Really black")
  264. Part.TopSurface = 0
  265. Part.BottomSurface = 0
  266. Part.FormFactor = "Custom"
  267. Part.Size = Vector3.new(0.3, 0.2, 0.3)
  268. Part.Parent = Parts
  269. local Weld = Instance.new("Weld")
  270. Weld.Part0 = Part
  271. Weld.Part1 = MasterPart
  272. Weld.C0 = CFrame.new(0, 1.151, 0.2)
  273. Weld.Parent = Weld.Part0
  274. Instance.new("CylinderMesh", Part)
  275.  
  276. local Part = Instance.new("Part")
  277. Part.Material = "SmoothPlastic"
  278. Part.Name = "Source"
  279. Part.TopSurface = 0
  280. Part.BottomSurface = 0
  281. Part.FormFactor = "Custom"
  282. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  283. Part.Transparency = 1
  284. Part.Parent = Parts
  285. local Weld = Instance.new("Weld")
  286. Weld.Part0 = Part
  287. Weld.Part1 = MasterPart
  288. Weld.C0 = CFrame.new(0, 2, 0.2)
  289. Weld.Parent = Weld.Part0
  290. local Fire = Instance.new("Fire", Part)
  291. Fire.Enabled = false
  292. Fire.Size = 3
  293. Fire.Heat = -10
  294. Fire.Color = Color
  295. Fire.SecondaryColor = Color3.new(1, 1, 1)
  296.  
  297. for _, Part in pairs(Parts:GetChildren()) do
  298. Part.Locked = true
  299. Part.CanCollide = false
  300. end
  301. end
  302.  
  303.  
  304. function RemoveParts(Parent, Format)
  305. if Format == 1 then
  306. pcall(function() Parent[ModelName.. " (Holstered)"]:Remove() end)
  307. elseif Format == 2 then
  308. pcall(function() Parent[ModelName]:Remove() end)
  309. end
  310. end
  311.  
  312.  
  313. function SetAngle(Joint, Angle, Character)
  314. if Character == nil then return false end
  315. local Joints = {
  316. Character.Torso:FindFirstChild("Right Shoulder 2"),
  317. Character.Torso:FindFirstChild("Left Shoulder 2"),
  318. Character.Torso:FindFirstChild("Right Hip 2"),
  319. Character.Torso:FindFirstChild("Left Hip 2")
  320. }
  321. if Joints[Joint] == nil then return false end
  322. if Joint == 1 or Joint == 3 then
  323. Joints[Joint].DesiredAngle = Angle
  324. end
  325. if Joint == 2 or Joint == 4 then
  326. Joints[Joint].DesiredAngle = -Angle
  327. end
  328. end
  329.  
  330.  
  331. function ForceAngle(Joint, Angle, Character)
  332. if Character == nil then return false end
  333. local Joints = {
  334. Character.Torso:FindFirstChild("Right Shoulder 2"),
  335. Character.Torso:FindFirstChild("Left Shoulder 2"),
  336. Character.Torso:FindFirstChild("Right Hip 2"),
  337. Character.Torso:FindFirstChild("Left Hip 2")
  338. }
  339. if Joints[Joint] == nil then return false end
  340. if Joint == 1 or Joint == 3 then
  341. Joints[Joint].DesiredAngle = Angle
  342. Joints[Joint].CurrentAngle = Angle
  343. end
  344. if Joint == 2 or Joint == 4 then
  345. Joints[Joint].DesiredAngle = -Angle
  346. Joints[Joint].CurrentAngle = -Angle
  347. end
  348. end
  349.  
  350.  
  351. function SetSpeed(Joint, Speed, Character)
  352. if Character == nil then return false end
  353. local Joints = {
  354. Character.Torso:FindFirstChild("Right Shoulder 2"),
  355. Character.Torso:FindFirstChild("Left Shoulder 2"),
  356. Character.Torso:FindFirstChild("Right Hip 2"),
  357. Character.Torso:FindFirstChild("Left Hip 2")
  358. }
  359. if Joints[Joint] == nil then return false end
  360. Joints[Joint].MaxVelocity = Speed
  361. end
  362.  
  363.  
  364. function DisableLimb(Limb, Character)
  365. if Character == nil then return false end
  366. if Character:FindFirstChild("Torso") == nil then return false end
  367. local Joints = {
  368. Character.Torso:FindFirstChild("Right Shoulder"),
  369. Character.Torso:FindFirstChild("Left Shoulder"),
  370. Character.Torso:FindFirstChild("Right Hip"),
  371. Character.Torso:FindFirstChild("Left Hip")
  372. }
  373. local Limbs = {
  374. Character:FindFirstChild("Right Arm"),
  375. Character:FindFirstChild("Left Arm"),
  376. Character:FindFirstChild("Right Leg"),
  377. Character:FindFirstChild("Left Leg")
  378. }
  379. if Joints[Limb] == nil then return false end
  380. if Limbs[Limb] == nil then return false end
  381. local Joint = Instance.new("Motor6D")
  382. Joint.Parent = Character.Torso
  383. Joint.Part0 = Character.Torso
  384. Joint.Part1 = Limbs[Limb]
  385. if Limb == 1 then
  386. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  387. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  388. Joint.Name = "Right Shoulder 2"
  389. elseif Limb == 2 then
  390. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  391. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  392. Joint.Name = "Left Shoulder 2"
  393. elseif Limb == 3 then
  394. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  395. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  396. Joint.Name = "Right Hip 2"
  397. elseif Limb == 4 then
  398. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  399. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  400. Joint.Name = "Left Hip 2"
  401. end
  402. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  403. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  404. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  405. Joints[Limb]:Remove()
  406. end
  407.  
  408.  
  409. function ResetLimbCFrame(Limb, Character)
  410. if Character == nil then return false end
  411. if Character.Parent == nil then return false end
  412. if Character:FindFirstChild("Torso") == nil then return false end
  413. local Joints = {
  414. Character.Torso:FindFirstChild("Right Shoulder 2"),
  415. Character.Torso:FindFirstChild("Left Shoulder 2"),
  416. Character.Torso:FindFirstChild("Right Hip 2"),
  417. Character.Torso:FindFirstChild("Left Hip 2")
  418. }
  419. local Limbs = {
  420. Character:FindFirstChild("Right Arm"),
  421. Character:FindFirstChild("Left Arm"),
  422. Character:FindFirstChild("Right Leg"),
  423. Character:FindFirstChild("Left Leg")
  424. }
  425. if Joints[Limb] == nil then return false end
  426. if Limbs[Limb] == nil then return false end
  427. if Limb == 1 then
  428. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  429. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  430. elseif Limb == 2 then
  431. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  432. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  433. elseif Limb == 3 then
  434. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  435. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  436. elseif Limb == 4 then
  437. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  438. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  439. end
  440. end
  441.  
  442.  
  443. function EnableLimb(Limb, Character)
  444. if Character == nil then return false end
  445. if Character:FindFirstChild("Torso") == nil then return false end
  446. local Joints = {
  447. Character.Torso:FindFirstChild("Right Shoulder 2"),
  448. Character.Torso:FindFirstChild("Left Shoulder 2"),
  449. Character.Torso:FindFirstChild("Right Hip 2"),
  450. Character.Torso:FindFirstChild("Left Hip 2")
  451. }
  452. local Limbs = {
  453. Character:FindFirstChild("Right Arm"),
  454. Character:FindFirstChild("Left Arm"),
  455. Character:FindFirstChild("Right Leg"),
  456. Character:FindFirstChild("Left Leg")
  457. }
  458. if Joints[Limb] == nil then return false end
  459. if Limbs[Limb] == nil then return false end
  460. if Limb == 1 then
  461. Joints[Limb].Name = "Right Shoulder"
  462. elseif Limb == 2 then
  463. Joints[Limb].Name = "Left Shoulder"
  464. elseif Limb == 3 then
  465. Joints[Limb].Name = "Right Hip"
  466. elseif Limb == 4 then
  467. Joints[Limb].Name = "Left Hip"
  468. end
  469. Animate = Character:FindFirstChild("Animate")
  470. if Animate == nil then return false end
  471. Animate = Animate:Clone()
  472. Character.Animate:Remove()
  473. Animate.Parent = Character
  474. end
  475.  
  476.  
  477. function onButton1Down(Mouse)
  478. if Button1Down == true then return end
  479. Button1Down = true
  480. if CheckPlayer() == false then return end
  481. if CanUse == true then
  482. SoundToServer("Click", "http://www.roblox.com/Asset/?id=2697295", 15, 0.25, false, Player.Character[ModelName].Handle)
  483. if script.Magazine.Value <= 0 then
  484. return
  485. end
  486. CanUse = false
  487. SoundToServer("Fire", "http://www.roblox.com/Asset/?id=10209248", 1.5, 1, false, Player.Character[ModelName].Handle)
  488. script.Magazine.Value = script.Magazine.Value - 1
  489. pcall(function() Player.Character[ModelName].Source.Fire.Enabled = true end)
  490. local SmokeHolder = Instance.new("Part", Workspace)
  491. SmokeHolder.Name = "Smoke Holder"
  492. SmokeHolder.TopSurface = 0
  493. SmokeHolder.BottomSurface = 0
  494. SmokeHolder.Transparency = 1
  495. SmokeHolder.Locked = true
  496. SmokeHolder.CanCollide = false
  497. SmokeHolder.Anchored = true
  498. SmokeHolder.FormFactor = "Custom"
  499. SmokeHolder.Size = Vector3.new()
  500. local Smoke = Instance.new("Smoke", SmokeHolder)
  501. Smoke.Size = 1
  502. Smoke.RiseVelocity = 5
  503. Smoke.Color = Color3.new(0.8, 0.8, 0.8)
  504. Smoke.Opacity = 0.5
  505. coroutine.wrap(function()
  506. for i = 1, 0, -0.05 do
  507. pcall(function() SmokeHolder.CFrame = CFrame.new(Player.Character[ModelName].Source.CFrame.p) end)
  508. Smoke.Opacity = i
  509. wait()
  510. end
  511. Smoke.Enabled = false
  512. wait(7)
  513. SmokeHolder:Remove()
  514. end)()
  515. local Flare = Instance.new("Part", Workspace)
  516. Flare.Material = "SmoothPlastic"
  517. Flare.Name = "Flare"
  518. Flare.TopSurface = 0
  519. Flare.BottomSurface = 0
  520. Flare.BrickColor = BrickColor.new(Color)
  521. Flare.Locked = true
  522. Flare.FormFactor = "Custom"
  523. Flare.Size = Vector3.new(0.6, 0.6, 0.6)
  524. Flare.CFrame = Player.Character[ModelName].Source.CFrame
  525. Flare.Elasticity = 1
  526. Flare.Friction = 1
  527. FlareLight = Instance.new("PointLight",Flare)
  528. FlareLight.Range = 40
  529. FlareLight.Brightness = 20
  530. FlareLight.Color = Color3.new(255,0,0)
  531. local Mesh = Instance.new("SpecialMesh", Flare)
  532. Mesh.MeshType = "Sphere"
  533. Mesh.Scale = Vector3.new(0.5, 0.5, 0.5)
  534. local creator = Instance.new("ObjectValue", Flare)
  535. creator.Name = "creator"
  536. creator.Value = Player
  537. local Fire = Instance.new("Fire", Flare)
  538. Fire.Color = Color
  539. Fire.SecondaryColor = Color3.new(1, 1, 1)
  540. Fire.Heat = 0
  541. Fire.Size = 10
  542. local BodyForce = Instance.new("BodyForce", Flare)
  543. BodyForce.force = Vector3.new(0, 40, 0)
  544. Flare.Velocity = ((Mouse.Hit.p - Player.Character[ModelName].Source.Position).unit * 175) + Vector3.new(math.random(-7500, 7500) / 1000, math.random(-7500, 7500) / 1000, math.random(-7500, 7500) / 1000)
  545. CameraPunch(math.rad(30), 0)
  546. wait(0.1)
  547. --[[if Hit.Parent == nil or Source.CanCollide == false then return end
  548. Source.Anchored = true
  549. Source.CanCollide = false
  550. Source.Transparency = 1
  551. Source.Fire.Enabled = false]]--
  552. --[[if Hit.Anchored == false then
  553. game:GetService("InsertService"):LoadAsset(61110829)["RealFire"].Parent = Hit
  554. Source.creator:Clone().Parent = Hit["RealFire"]
  555. end]]--
  556. wait(7)
  557. --Source:Remove()
  558. pcall(function() Player.Character[ModelName].Source.Fire.Enabled = false end)
  559. wait(0.5)
  560. CanUse = true
  561. end
  562. end
  563.  
  564.  
  565. function onButton1Up(Mouse)
  566. Button1Down = false
  567. end
  568.  
  569.  
  570. function onKeyDown(Key, Mouse)
  571. if Selected == false then return end
  572. Key = Key:lower()
  573. if Button1Down == false and CanUse == true and CheckPlayer() == true then
  574. if Key == "q" then
  575. if Mouse.Target == nil then return end
  576. if CheckPlayer() == false then return end
  577. local NewPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)
  578. if NewPlayer == nil then return end
  579. if NewPlayer.Character == nil then return end
  580. if NewPlayer.Character:FindFirstChild("Torso") == nil then return end
  581. if (NewPlayer.Character.Torso.Position - Player.Character.Torso.Position).magnitude > 10 then return end
  582. onDeselected(Mouse)
  583. wait()
  584. RemoveParts(Player.Character, 1)
  585. script.Parent.Parent = NewPlayer.Backpack
  586. Player = NewPlayer
  587. elseif Key == "r" then
  588. if script.Magazine.Value >= MagazineCapacity or Player.Backpack.Ammo[AmmoType].Value <= 0 then return end
  589. CanUse = false
  590. DisableLimb(2, Player.Character)
  591. SetSpeed(1, 0.5, Player.Character)
  592. SetAngle(1, 0, Player.Character)
  593. SetSpeed(2, 0.5, Player.Character)
  594. SetAngle(2, 0, Player.Character)
  595. wait(0.1)
  596. local Flare = Instance.new("Part")
  597. Flare.Name = "Flare"
  598. Flare.BrickColor = BrickColor.new(Color)
  599. Flare.TopSurface = 0
  600. Flare.BottomSurface = 0
  601. Flare.FormFactor = "Custom"
  602. Flare.Size = Vector3.new(0.3, 0.3, 0.3)
  603. Flare.Locked = true
  604. Flare.Parent = Workspace
  605. Instance.new("SpecialMesh", Flare).MeshType = "Sphere"
  606. local Weld = Instance.new("Weld")
  607. Weld.Part0 = Flare
  608. Weld.Part1 = Player.Character:FindFirstChild("Left Arm")
  609. Weld.C0 = CFrame.new(0, 1, 0)
  610. Weld.Parent = Weld.Part0
  611. SoundToServer("Click", "http://www.roblox.com/Asset/?id=2697295", 0.6, 1, false, Player.Character[ModelName].Handle)
  612. for i = 0, 1, 0.1 do
  613. pcall(function()
  614. Player.Character[ModelName].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, 0, math.rad(85 * i))
  615. Player.Character.Torso["Right Shoulder 2"].C0 =
  616. CFrame.new(1.5 - (0.5 * i), 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(45 * i), 0, math.rad(-15 * i))
  617. Player.Character.Torso["Right Shoulder 2"].C1 =
  618. CFrame.new(0, 0.5, 0)
  619. Player.Character.Torso["Left Shoulder 2"].C0 =
  620. CFrame.new(-1.5 + (0.5 * i), 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(65 * i), 0, math.rad(15 * i))
  621. Player.Character.Torso["Left Shoulder 2"].C1 =
  622. CFrame.new(0, 0.5, 0)
  623. end)
  624. CameraPunch(math.rad(-1), 0)
  625. wait()
  626. end
  627. script.Magazine.Value = MagazineCapacity
  628. Player.Backpack.Ammo[AmmoType].Value = Player.Backpack.Ammo[AmmoType].Value - MagazineCapacity
  629. Flare:Remove()
  630. for i = 1, 0, -0.1 do
  631. pcall(function()
  632. Player.Character[ModelName].Handle.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, 0, math.rad(85 * i))
  633. Player.Character.Torso["Right Shoulder 2"].C0 =
  634. CFrame.new(1.5 - (0.5 * i), 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(45 * i), 0, math.rad(-15 * i))
  635. Player.Character.Torso["Right Shoulder 2"].C1 =
  636. CFrame.new(0, 0.5, 0)
  637. Player.Character.Torso["Left Shoulder 2"].C0 =
  638. CFrame.new(-1.5 + (0.5 * i), 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(65 * i), 0, math.rad(15 * i))
  639. Player.Character.Torso["Left Shoulder 2"].C1 =
  640. CFrame.new(0, 0.5, 0)
  641. end)
  642. CameraPunch(math.rad(1), 0)
  643. wait()
  644. end
  645. pcall(function()
  646. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new()
  647. end)
  648. SetAngle(1, math.rad(90), Player.Character)
  649. ResetLimbCFrame(1, Player.Character)
  650. ResetLimbCFrame(2, Player.Character)
  651. EnableLimb(1, Player.Character)
  652. EnableLimb(2, Player.Character)
  653. DisableLimb(1, Player.Character)
  654. wait()
  655. CanUse = true
  656. elseif Key == "g" then
  657. CanUse = false
  658. SetSpeed(1, 0.45, Player.Character)
  659. SetAngle(1, math.rad(175), Player.Character)
  660. SoundToServer("Slash", "rbxasset://sounds/swordslash.wav", 2, 1, false, Player.Character.Torso)
  661. CameraSlide(math.rad(15), 0, 0.15)
  662. SetSpeed(1, 0.8, Player.Character)
  663. SetAngle(1, math.rad(10), Player.Character)
  664. local HasHit = false
  665. local _, HitConnection = pcall(function() return Player.Character[ModelName].Barrel.Touched:connect(function(Hit)
  666. if HasHit == true or Hit:IsDescendantOf(Player.Character) then return end
  667. HasHit = true
  668. SoundToServer("Bash", "http://www.roblox.com/Asset/?id=46153268", 1, 0.25, false, Player.Character.Torso)
  669. local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
  670. if Humanoid ~= nil then
  671. tagHumanoid(Humanoid)
  672. Humanoid:TakeDamage(8)
  673. wait()
  674. pcall(function() untagHumanoid(Humanoid) end)
  675. end
  676. end) end)
  677. CameraSlide(math.rad(-20), 0, 0.15)
  678. pcall(function() HitConnection:disconnect() end)
  679. SetSpeed(1, 0.2, Player.Character)
  680. SetAngle(1, math.rad(90), Player.Character)
  681. CameraSlide(math.rad(5), 0, 0.15)
  682. CanUse = true
  683. end
  684. end
  685. end
  686.  
  687.  
  688. function onSelected(Mouse)
  689. if Selected == true or CanUse == false then return end
  690. CanUse = false
  691. while true do
  692. if CheckPlayer() == true then
  693. if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil and Player.Character.Torso:FindFirstChild("Left Shoulder") ~= nil then
  694. break
  695. end
  696. end
  697. wait(0.1)
  698. end
  699. Selected = true
  700. DisableLimb(1, Player.Character)
  701. SetSpeed(1, 0.5, Player.Character)
  702. SetAngle(1, 0, Player.Character)
  703. wait()
  704. RemoveParts(Player.Character, 1)
  705. CreateParts(Player.Character, 2)
  706. SetSpeed(1, 0.4, Player.Character)
  707. SetAngle(1, math.rad(90), Player.Character)
  708. wait(0.2)
  709. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  710. Mouse.Button1Down:connect(function() onButton1Down(Mouse) end)
  711. Mouse.Button1Up:connect(function() onButton1Up(Mouse) end)
  712. Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end)
  713. CanUse = true
  714. end
  715.  
  716.  
  717. function onDeselected(Mouse)
  718. if Selected == false then return end
  719. Selected = false
  720. while CanUse == false do wait() end
  721. if Selected == true then return end
  722. CanUse = false
  723. RemoveParts(Player.Character, 2)
  724. CreateParts(Player.Character, 1)
  725. SetAngle(1, 0, Player.Character)
  726. EnableLimb(1, Player.Character)
  727. CanUse = true
  728. end
  729.  
  730.  
  731. if script.Parent.ClassName ~= "HopperBin" then
  732. if Player == nil then print("Error: Player not found!") return end
  733. Tool = Instance.new("HopperBin")
  734. Tool.Name = ModelName
  735. Tool.Parent = Player.Backpack
  736. Instance.new("IntValue", script).Name = "Magazine"
  737. script.Name = "Main"
  738. script.Parent = Tool
  739. elseif script.Parent.ClassName == "HopperBin" and Connected == false then
  740. Connected = true
  741. Player = script.Parent.Parent.Parent
  742. end wait() if script.Parent.ClassName == "HopperBin" then
  743. while script.Parent.Parent.ClassName ~= "Backpack" do
  744. wait()
  745. end
  746. Instance.new("Configuration", Player.Backpack).Name = "Ammo"
  747. Instance.new("IntValue", Player.Backpack.Ammo).Name = AmmoType
  748. Player.Backpack.Ammo[AmmoType].Value = 10
  749. script.Parent.Selected:connect(onSelected)
  750. script.Parent.Deselected:connect(onDeselected)
  751. CreateParts(Player.Character, 1)
  752. --[[
  753. MouseAim v11
  754. --]]
  755.  
  756.  
  757. script.Parent.Selected:connect(function(Mouse)
  758. while Selected == false do wait() end
  759. while Selected == true do
  760. if script.Parent == nil then break end
  761. if Player.Character:FindFirstChild("Humanoid") == nil or Player.Character:FindFirstChild("Torso") == nil then break end
  762. if Player.Character.Humanoid.Health > 0 and Player.Character.Humanoid.Sit == false and Player.Character.Humanoid.PlatformStand == false and Player.Character.Torso:FindFirstChild("BodyGyro") == nil and Player.Character.Torso:FindFirstChild("BodyAngularVelocity") == nil and Player.Character:FindFirstChild("Ragdoll") == nil then
  763. local AimGyro = Instance.new("BodyGyro")
  764. game:GetService("Debris"):AddItem(AimGyro, 0)
  765. AimGyro.Parent = Player.Character.Torso
  766. AimGyro.Name = "AimGyro"
  767. AimGyro.P = 40000
  768. AimGyro.D = 300
  769. AimGyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  770. AimGyro.cframe = CFrame.new(Player.Character.Torso.Position, Vector3.new(Mouse.Hit.p.x, Player.Character.Torso.Position.y, Mouse.Hit.p.z)) * (Player.Character:FindFirstChild("AimGyroAdd") and Player.Character.AimGyroAdd.Value or CFrame.new())
  771. end
  772. wait()
  773. end
  774. end)
  775. --[[
  776. AmmoCounter v5
  777. --]]
  778.  
  779.  
  780. local Gui = nil
  781.  
  782.  
  783. local function Remove()
  784. if Gui ~= nil then
  785. local Gui2 = Gui
  786. Gui = nil
  787. if Gui2.Parent ~= nil then
  788. Gui2.AmmoCounter:TweenPosition(UDim2.new(0.35, 0, 1, 0), "In", "Quart", 0.5, true)
  789. wait(0.5)
  790. end
  791. Gui2:Remove()
  792. end
  793. end
  794.  
  795.  
  796. script.Parent.Selected:connect(function(Mouse)
  797. while Selected == false do wait() end
  798. local DualConnection1, DualConnection2
  799. Gui = Instance.new("ScreenGui", Player.PlayerGui)
  800. Gui.Name = "AmmoCounter"
  801. local AmmoCounter = Instance.new("Frame", Gui)
  802. AmmoCounter.Name = "AmmoCounter"
  803. AmmoCounter.BorderColor3 = Color3.new(0, 0, 0)
  804. AmmoCounter.BackgroundTransparency = 0.8
  805. AmmoCounter.BackgroundColor3 = Color3.new(0.7, 0.7, 0.7)
  806. AmmoCounter.Size = UDim2.new(0.3, 0, 0, 100)
  807. AmmoCounter.Position = UDim2.new(0.35, 0, 1, 0)
  808. AmmoCounter:TweenPosition(UDim2.new(0.35, 0, 1, -200), "Out", "Quart", 0.5, true)
  809. local Notification = Instance.new("TextLabel", AmmoCounter)
  810. Notification.Name = "Notification"
  811. Notification.Text = ""
  812. Notification.TextTransparency = 1
  813. Notification.Font = "ArialBold"
  814. Notification.FontSize = "Size18"
  815. Notification.BorderColor3 = Color3.new(0, 0, 0)
  816. Notification.BackgroundTransparency = 0.3
  817. Notification.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  818. Notification.Size = UDim2.new(1, -10, 0, 20)
  819. Notification.Position = UDim2.new(0, 5, 0, 5)
  820. coroutine.wrap(function()
  821. local Reloading = false
  822. local OldMagazine = script.Magazine.Value
  823. local OldMagazineDual = nil
  824. pcall(function() OldMagazineDual = script.Dual.Main.Magazine.Value end)
  825. while Notification.Parent ~= nil do
  826. if OldMagazineDual == nil then
  827. pcall(function() OldMagazineDual = script.Dual.Main.Magazine.Value end)
  828. end
  829. if Reloading == false then
  830. if ((script.Magazine.Value > OldMagazine or OldMagazine - script.Magazine.Value > 1) or (Dual == true and (script.Dual.Main.Magazine.Value > OldMagazineDual or OldMagazineDual - script.Dual.Main.Magazine.Value > 1))) and CanUse == false then
  831. Reloading = true
  832. end
  833. else
  834. if CanUse == true then
  835. Reloading = false
  836. end
  837. end
  838. OldMagazine = script.Magazine.Value
  839. pcall(function() OldMagazineDual = script.Dual.Main.Magazine.Value end)
  840. if Reloading == true then
  841. Notification.TextTransparency = 0
  842. Notification.TextColor3 = Color3.new(0.1, 0.8, 0.1)
  843. Notification.Text = "Reloading..."
  844. wait()
  845. else
  846. if (script.Magazine.Value / MagazineCapacity < 0.2) or (Dual == true and (script.Dual.Main.Magazine.Value / MagazineCapacity < 0.2)) then
  847. Notification.TextColor3 = Color3.new(1, 0.1, 0.05)
  848. Notification.TextTransparency = 0
  849. else
  850. Notification.TextColor3 = CanUse == false and Color3.new(0.8, 0.8, 0.8) or Color3.new(0, 0, 0)
  851. Notification.TextTransparency = 0
  852. end
  853. Notification.Text = "Magazine: " ..script.Magazine.Value .. (Dual == true and ("/" ..script.Dual.Main.Magazine.Value) or "")
  854. wait()
  855. end
  856. end
  857. end)()
  858. for x = 1, Dual ~= nil and 2 or 1 do
  859. for i = 1, MagazineCapacity + MagazineCapacityAdd do
  860. local Bullet = Instance.new("Frame", AmmoCounter)
  861. Bullet.Name = i.. ", " ..x
  862. Bullet.BorderColor3 = Color3.new(0, 0, 0)
  863. if i > script.Magazine.Value then
  864. Bullet.BackgroundTransparency = 0.8
  865. Bullet.BackgroundColor3 = Color3.new(0.7, 0.7, 0.7)
  866. else
  867. Bullet.BackgroundTransparency = 0.3
  868. Bullet.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  869. end
  870. Bullet.Size = UDim2.new(1 / (MagazineCapacity + MagazineCapacityAdd), -10, 0, Dual ~= nil and 20 or 40)
  871. Bullet.Position = UDim2.new((i - 1) / (MagazineCapacity + MagazineCapacityAdd), 5, 0, 30 + (20 * (x - 1)))
  872. end
  873. end
  874. local function Check(Value, y)
  875. return Value.Changed:connect(function()
  876. for i = 1, MagazineCapacity + MagazineCapacityAdd do
  877. AmmoCounter[i.. ", " ..y].BackgroundTransparency = 0.8
  878. AmmoCounter[i.. ", " ..y].BackgroundColor3 = Color3.new(0.7, 0.7, 0.7)
  879. end
  880. for i = 1, Value.Value do
  881. AmmoCounter[i.. ", " ..y].BackgroundTransparency = 0.3
  882. AmmoCounter[i.. ", " ..y].BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  883. end
  884. end)
  885. end
  886. Check(script.Magazine, 1)
  887. if Dual == true then
  888. DualConnection1 = Check(script.Dual.Main.Magazine, 2)
  889. coroutine.wrap(function()
  890. while Dual == true do
  891. wait()
  892. end
  893. pcall(function() DualConnection1:disconnect() end)
  894. end)()
  895. else
  896. DualConnection1 = script.ChildAdded:connect(function(Child)
  897. if Child.Name == "Dual" then
  898. DualConnection2 = Check(Child.Main.Magazine, 2)
  899. coroutine.wrap(function()
  900. wait()
  901. for i = 1, MagazineCapacity + MagazineCapacityAdd do
  902. AmmoCounter[i.. ", 2"].BackgroundTransparency = 0.8
  903. AmmoCounter[i.. ", 2"].BackgroundColor3 = Color3.new(0.7, 0.7, 0.7)
  904. end
  905. for i = 1, Child.Main.Magazine.Value do
  906. AmmoCounter[i.. ", 2"].BackgroundTransparency = 0.3
  907. AmmoCounter[i.. ", 2"].BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  908. end
  909. while Dual == true do
  910. wait()
  911. end
  912. pcall(function() DualConnection2:disconnect() end)
  913. for i = 1, MagazineCapacity + MagazineCapacityAdd do
  914. AmmoCounter[i.. ", 2"].BackgroundTransparency = 0.8
  915. AmmoCounter[i.. ", 2"].BackgroundColor3 = Color3.new(0.7, 0.7, 0.7)
  916. end
  917. end)()
  918. end
  919. end)
  920. end
  921. local ModelNameLabel = Instance.new("TextLabel", AmmoCounter)
  922. ModelNameLabel.Name = "ModelNameLabel"
  923. ModelNameLabel.Text = " " ..ModelName
  924. ModelNameLabel.TextColor3 = Color3.new(0, 0, 0)
  925. ModelNameLabel.Font = "ArialBold"
  926. ModelNameLabel.FontSize = "Size14"
  927. ModelNameLabel.TextXAlignment = "Left"
  928. ModelNameLabel.BorderColor3 = Color3.new(0, 0, 0)
  929. ModelNameLabel.BackgroundTransparency = 0.3
  930. ModelNameLabel.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  931. ModelNameLabel.Size = UDim2.new(1, -10, 0, 20)
  932. ModelNameLabel.Position = UDim2.new(0, 5, 0, 75)
  933. local TotalAmmo = ModelNameLabel:Clone()
  934. TotalAmmo.Parent = AmmoCounter
  935. TotalAmmo.Name = "TotalAmmo"
  936. TotalAmmo.Text = Player.Backpack.Ammo[AmmoType].Value.. " " ..AmmoType.. " "
  937. TotalAmmo.TextXAlignment = "Right"
  938. TotalAmmo.BorderSizePixel = 0
  939. TotalAmmo.BackgroundTransparency = 1
  940. TotalAmmo.Size = UDim2.new(1, - 10, 0, 20)
  941. TotalAmmo.Position = UDim2.new(0, 5, 1, -25)
  942. Player.Backpack.Ammo[AmmoType].Changed:connect(function()
  943. TotalAmmo.Text = Player.Backpack.Ammo[AmmoType].Value.. " " ..AmmoType.. " "
  944. end)
  945. coroutine.wrap(function()
  946. while Selected == true do
  947. wait()
  948. end
  949. Remove()
  950. pcall(function() DualConnection1:disconnect() end)
  951. pcall(function() DualConnection2:disconnect() end)
  952. end)()
  953. end)
  954. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement