Advertisement
Kittdy2

Untitled

Jan 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 59.24 KB | None | 0 0
  1. --MADE BY OneLegend (NOT THE SCRIPT) Thanks to CyberFromLU for letting me Publish! REGULAR SCRIPT: Go to line 3 and 1607 put your name where it says "YOUR NAME HERE"
  2. -------------------------------------------------------------------
  3. -- This script has been converted to FE by iPxter
  4.  
  5.  
  6. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  7. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  8. do
  9. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  10. script.Parent = Player.Character
  11.  
  12. --RemoteEvent for communicating
  13. local Event = Instance.new("RemoteEvent")
  14. Event.Name = "UserInput_Event"
  15.  
  16. --Fake event to make stuff like Mouse.KeyDown work
  17. local function fakeEvent()
  18. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  19. t.connect = t.Connect
  20. return t
  21. end
  22.  
  23. --Creating fake input objects with fake variables
  24. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  25. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  26. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  27. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  28. end}
  29. --Merged 2 functions into one by checking amount of arguments
  30. CAS.UnbindAction = CAS.BindAction
  31.  
  32. --This function will trigger the events that have been :Connect()'ed
  33. local function te(self,ev,...)
  34. local t = m[ev]
  35. if t and t._fakeEvent and t.Function then
  36. t.Function(...)
  37. end
  38. end
  39. m.TrigEvent = te
  40. UIS.TrigEvent = te
  41.  
  42. Event.OnServerEvent:Connect(function(plr,io)
  43. if plr~=Player then return end
  44. if io.isMouse then
  45. m.Target = io.Target
  46. m.Hit = io.Hit
  47. else
  48. local b = io.UserInputState == Enum.UserInputState.Begin
  49. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  50. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  51. end
  52. for _,t in pairs(CAS.Actions) do
  53. for _,k in pairs(t.Keys) do
  54. if k==io.KeyCode then
  55. t.Function(t.Name,io.UserInputState,io)
  56. end
  57. end
  58. end
  59. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  60. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  61. end
  62. end)
  63. Event.Parent = NLS([==[
  64. local Player = game:GetService("Players").LocalPlayer
  65. local Event = script:WaitForChild("UserInput_Event")
  66.  
  67. local UIS = game:GetService("UserInputService")
  68. local input = function(io,a)
  69. if a then return end
  70. --Since InputObject is a client-side instance, we create and pass table instead
  71. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  72. end
  73. UIS.InputBegan:Connect(input)
  74. UIS.InputEnded:Connect(input)
  75.  
  76. local Mouse = Player:GetMouse()
  77. local h,t
  78. --Give the server mouse data 30 times every second, but only if the values changed
  79. --If player is not moving their mouse, client won't fire events
  80. while wait(1/30) do
  81. if h~=Mouse.Hit or t~=Mouse.Target then
  82. h,t=Mouse.Hit,Mouse.Target
  83. Event:FireServer({isMouse=true,Target=t,Hit=h})
  84. end
  85. end]==],Player.Character)
  86. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  87. end
  88.  
  89.  
  90.  
  91. Player = script:FindFirstChild("Player") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("Gaminhyena") --Replace my name with yours for the RPG to work.
  92. Name = "Burstfire" --Sets name of the RPG.
  93. selected = true
  94. canDual = false
  95. dual = false
  96. Button1Down = false
  97. damage = 100 --Sets damage also.
  98. canFire = true
  99. canFire2 = false
  100. readyTime = 0.5
  101. automatic = false
  102. burst = false
  103. burstCount = 0
  104. burstCountMax = 3
  105. canSilence = false
  106. silenced = false
  107. canZoom = true
  108. zoom = false
  109. switchToSingle = true
  110. switchToBurst = true
  111. switchToAutomatic = false
  112.  
  113.  
  114. ammoGui = Instance.new("ScreenGui")
  115. ammoGui.Name = Name
  116. local frame = Instance.new("Frame")
  117. frame.Name = "Frame"
  118. frame.Size = UDim2.new(0, 165, 0, 60)
  119. frame.Position = UDim2.new(0, 0, 1, -60)
  120. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  121. frame.BorderColor3 = Color3.new(0, 0, 0)
  122. frame.Parent = ammoGui
  123. local label = Instance.new("TextLabel")
  124. label.Name = "Weapon"
  125. label.Text = "Weapon: " ..Name
  126. label.Size = UDim2.new(1, 0, 0, 20)
  127. label.Position = UDim2.new(0, 0, 0, 0)
  128. label.BackgroundColor3 = Color3.new(1, 0, 0)
  129. label.BorderColor3 = Color3.new(0, 0, 0)
  130. label.Parent = frame
  131. local label = Instance.new("TextLabel")
  132. label.Name = "MagazinePrefix"
  133. label.Text = " Magazine:"
  134. label.TextXAlignment = "Left"
  135. label.Size = UDim2.new(1, 0, 0, 20)
  136. label.Position = UDim2.new(0, 0, 0, 20)
  137. label.BackgroundColor3 = Color3.new(1, 1, 1)
  138. label.BorderColor3 = Color3.new(0, 0, 0)
  139. label.Parent = frame
  140. local label = Instance.new("TextLabel")
  141. label.Name = "Magazine"
  142. label.Text = "0/0"
  143. label.TextXAlignment = "Right"
  144. label.Size = UDim2.new(1, 0, 0, 20)
  145. label.Position = UDim2.new(0, -10, 0, 20)
  146. label.BackgroundTransparency = 1
  147. label.BorderSizePixel = 0
  148. label.Parent = frame
  149. local label = Instance.new("TextLabel")
  150. label.Name = "AmmoPrefix"
  151. label.Text = " Ammunition:"
  152. label.TextXAlignment = "Left"
  153. label.Size = UDim2.new(1, 0, 0, 20)
  154. label.Position = UDim2.new(0, 0, 0, 40)
  155. label.BackgroundColor3 = Color3.new(1, 1, 1)
  156. label.BorderColor3 = Color3.new(0, 0, 0)
  157. label.Parent = frame
  158. local label = Instance.new("TextLabel")
  159. label.Name = "Ammo"
  160. label.Text = "0/0"
  161. label.TextXAlignment = "Right"
  162. label.Size = UDim2.new(1, 0, 0, 20)
  163. label.Position = UDim2.new(0, -10, 0, 40)
  164. label.BackgroundTransparency = 1
  165. label.BorderSizePixel = 0
  166. label.Parent = frame
  167.  
  168.  
  169. function updateGui()
  170. if selected == false then return end
  171. if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
  172. if Player.PlayerGui:FindFirstChild(Name) == nil then
  173. ammoGui:Clone().Parent = Player.PlayerGui
  174. end
  175. Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
  176. Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
  177. end
  178.  
  179.  
  180. function makeParts(format)
  181. local model = Instance.new("Model")
  182. model.Name = Name
  183. local pm = Instance.new("Part")
  184. pm.Name = "Handle"
  185. pm.FormFactor = "Custom"
  186. pm.Size = Vector3.new(1, 1, 1)
  187. pm.BrickColor = BrickColor.new("Black")
  188. pm.Locked = true
  189. pm.TopSurface = 0
  190. pm.BottomSurface = 0
  191. pm.Parent = model
  192. local m = Instance.new("CylinderMesh")
  193. m.Scale = Vector3.new(0.35, 1.5, 0.35)
  194. m.Parent = pm
  195. if format ~= nil then
  196. local w = Instance.new("Weld")
  197. w.Part0 = pm
  198. if format == "RightHand" then
  199. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  200. w.C0 = CFrame.new(0, 1.5, 0.75)
  201. w.C1 = CFrame.new()
  202. elseif format == "RightHolster" then
  203. w.Part1 = Player.Character:FindFirstChild("Torso")
  204. w.C0 = CFrame.new(-0.65, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(185), math.rad(90), 0)
  205. w.C1 = CFrame.new()
  206. model.Name = Name.. " (Holstered)"
  207. end
  208. w.Parent = pm
  209. model.Parent = Player.Character
  210. end
  211. --[[
  212. sniper1 http://www.roblox.com/Asset/?id=1868836
  213. equip http://www.roblox.com/Asset/?id=13510737
  214. fire1 http://www.roblox.com/Asset/?id=2760979
  215. fire2 http://www.roblox.com/Asset/?id=13510352
  216. fire3 http://www.roblox.com/Asset/?id=2692806
  217. fire4 http://www.roblox.com/Asset/?id=2691586
  218. fire5 http://www.roblox.com/Asset/?id=2920959
  219. fire6 http://www.roblox.com/Asset/?id=2697431
  220. fire7 http://www.roblox.com/Asset/?id=2920959
  221. reload1 http://www.roblox.com/Asset/?id=2691591
  222. reload2 http://www.roblox.com/Asset/?id=2697432
  223. reload3 http://www.roblox.com/Asset/?id=2920960
  224. reload4 http://www.roblox.com/Asset/?id=2761842
  225. shotgun1 http://www.roblox.com/Asset/?id=2697294
  226. --]]
  227. local s = Instance.new("Sound")
  228. s.Name = "Equip"
  229. s.SoundId = "http://www.roblox.com/Asset/?id=10209881"
  230. s.Volume = 1
  231. s.Pitch = 1
  232. s.Looped = false
  233. s.Parent = pm
  234. local s = Instance.new("Sound")
  235. s.Name = "Fire"
  236. s.SoundId = "rbxasset://sounds/Shoulder fired rocket.wav"
  237. s.Volume = 1
  238. s.Pitch = 1.25
  239. s.Looped = false
  240. s.Parent = pm
  241. local s = Instance.new("Sound")
  242. s.Name = "Reload"
  243. s.SoundId = "http://www.roblox.com/Asset/?id=2691591"
  244. s.Volume = 1
  245. s.Pitch = 1.25
  246. s.Looped = false
  247. s.Parent = pm
  248. local s = Instance.new("Sound")
  249. s.Name = "Empty"
  250. s.SoundId = "http://www.roblox.com/Asset/?id=2697295"
  251. s.Volume = 1
  252. s.Pitch = 5
  253. s.Looped = false
  254. s.Parent = pm
  255. local s = Instance.new("Sound")
  256. s.Name = "Switch"
  257. s.SoundId = "http://www.roblox.com/Asset/?id=2697295"
  258. s.Volume = 1
  259. s.Pitch = 10
  260. s.Looped = false
  261. s.Parent = pm
  262. local p = Instance.new("Part")
  263. p.Name = "Grip / Trigger Housing"
  264. p.FormFactor = "Custom"
  265. p.Size = Vector3.new(1, 1, 1)
  266. p.BrickColor = BrickColor.new("Black")
  267. p.Locked = true
  268. p.TopSurface = 0
  269. p.BottomSurface = 0
  270. p.Parent = model
  271. local m = Instance.new("SpecialMesh")
  272. m.MeshType = "Brick"
  273. m.Scale = Vector3.new(0.29, 0.75, 0.1)
  274. m.Parent = p
  275. local w = Instance.new("Weld")
  276. w.Part0 = p
  277. w.Part1 = pm
  278. w.C0 = CFrame.new(0, -0.2, -0.15)
  279. w.C1 = CFrame.new()
  280. w.Parent = p
  281. local p = Instance.new("Part")
  282. p.Name = "Grip 1"
  283. p.FormFactor = "Custom"
  284. p.Size = Vector3.new(1, 1, 1)
  285. p.BrickColor = BrickColor.new("Black")
  286. p.Locked = true
  287. p.TopSurface = 0
  288. p.BottomSurface = 0
  289. p.Parent = model
  290. local m = Instance.new("SpecialMesh")
  291. m.MeshType = "Brick"
  292. m.Scale = Vector3.new(0.29, 0.35, 0.9)
  293. m.Parent = p
  294. local w = Instance.new("Weld")
  295. w.Part0 = p
  296. w.Part1 = pm
  297. w.C0 = CFrame.new(0, -0.4, -0.65)
  298. w.C1 = CFrame.new()
  299. w.Parent = p
  300. local p = Instance.new("Part")
  301. p.Name = "Grip 2"
  302. p.FormFactor = "Custom"
  303. p.Size = Vector3.new(1, 1, 1)
  304. p.BrickColor = BrickColor.new("Reddish brown")
  305. p.Material = "Wood"
  306. p.Locked = true
  307. p.TopSurface = 0
  308. p.BottomSurface = 0
  309. p.Parent = model
  310. local m = Instance.new("SpecialMesh")
  311. m.MeshType = "Brick"
  312. m.Scale = Vector3.new(0.29, 0.35, 0.8)
  313. m.Parent = p
  314. local w = Instance.new("Weld")
  315. w.Part0 = p
  316. w.Part1 = pm
  317. w.C0 = CFrame.new(0, -1.1, -0.575)
  318. w.C1 = CFrame.new()
  319. w.Parent = p
  320. local p = Instance.new("Part")
  321. p.Name = "Trigger Housing 1"
  322. p.FormFactor = "Custom"
  323. p.Size = Vector3.new(1, 1, 1)
  324. p.BrickColor = BrickColor.new("Black")
  325. p.Locked = true
  326. p.TopSurface = 0
  327. p.BottomSurface = 0
  328. p.Parent = model
  329. local m = Instance.new("SpecialMesh")
  330. m.MeshType = "Brick"
  331. m.Scale = Vector3.new(0.1, 0.25, 0.025)
  332. m.Parent = p
  333. local w = Instance.new("Weld")
  334. w.Part0 = p
  335. w.Part1 = pm
  336. w.C0 = CFrame.new(0, -0.1, -0.5)
  337. w.C1 = CFrame.new()
  338. w.Parent = p
  339. local p = Instance.new("Part")
  340. p.Name = "Trigger Housing 2"
  341. p.FormFactor = "Custom"
  342. p.Size = Vector3.new(1, 1, 1)
  343. p.BrickColor = BrickColor.new("Black")
  344. p.Locked = true
  345. p.TopSurface = 0
  346. p.BottomSurface = 0
  347. p.Parent = model
  348. local m = Instance.new("SpecialMesh")
  349. m.MeshType = "Brick"
  350. m.Scale = Vector3.new(0.1, 0.025, 0.3)
  351. m.Parent = p
  352. local w = Instance.new("Weld")
  353. w.Part0 = p
  354. w.Part1 = pm
  355. w.C0 = CFrame.new(0, 0.01, -0.35)
  356. w.C1 = CFrame.new()
  357. w.Parent = p
  358. local p = Instance.new("Part")
  359. p.Name = "Trigger"
  360. p.FormFactor = "Custom"
  361. p.Size = Vector3.new(1, 1, 1)
  362. p.BrickColor = BrickColor.new("Black")
  363. p.Locked = true
  364. p.TopSurface = 0
  365. p.BottomSurface = 0
  366. p.Parent = model
  367. local m = Instance.new("SpecialMesh")
  368. m.MeshType = "Brick"
  369. m.Scale = Vector3.new(0.1, 0.05, 0.15)
  370. m.Parent = p
  371. local w = Instance.new("Weld")
  372. w.Part0 = p
  373. w.Part1 = pm
  374. w.C0 = CFrame.new(0, -0.11, -0.275)
  375. w.C1 = CFrame.new()
  376. w.Parent = p
  377. local p = Instance.new("Part")
  378. p.Name = "Center 1"
  379. p.FormFactor = "Custom"
  380. p.Size = Vector3.new(1, 1, 1)
  381. p.BrickColor = BrickColor.new("Black")
  382. p.Locked = true
  383. p.TopSurface = 0
  384. p.BottomSurface = 0
  385. p.Parent = model
  386. local m = Instance.new("CylinderMesh")
  387. m.Scale = Vector3.new(0.4, 0.5, 0.4)
  388. m.Parent = p
  389. local w = Instance.new("Weld")
  390. w.Part0 = p
  391. w.Part1 = pm
  392. w.C0 = CFrame.new(0, -1, 0)
  393. w.C1 = CFrame.new()
  394. w.Parent = p
  395. local p = Instance.new("Part")
  396. p.Name = "Center 2"
  397. p.FormFactor = "Custom"
  398. p.Size = Vector3.new(1, 1, 1)
  399. p.BrickColor = BrickColor.new("Reddish brown")
  400. p.Material = "Wood"
  401. p.Locked = true
  402. p.TopSurface = 0
  403. p.BottomSurface = 0
  404. p.Parent = model
  405. local m = Instance.new("CylinderMesh")
  406. m.Scale = Vector3.new(0.45, 1, 0.45)
  407. m.Parent = p
  408. local w = Instance.new("Weld")
  409. w.Part0 = p
  410. w.Part1 = pm
  411. w.C0 = CFrame.new(0, -1.75, 0)
  412. w.C1 = CFrame.new()
  413. w.Parent = p
  414. local p = Instance.new("Part")
  415. p.Name = "Center 3"
  416. p.FormFactor = "Custom"
  417. p.Size = Vector3.new(1, 1, 1)
  418. p.BrickColor = BrickColor.new("Reddish brown")
  419. p.Material = "Wood"
  420. p.Locked = true
  421. p.TopSurface = 0
  422. p.BottomSurface = 0
  423. p.Parent = model
  424. local m = Instance.new("SpecialMesh")
  425. m.MeshType = "FileMesh"
  426. m.MeshId = "http://www.roblox.com/Asset/?id=1778999"
  427. m.Scale = Vector3.new(0.335, 0.45, 0.335)
  428. m.Parent = p
  429. local w = Instance.new("Weld")
  430. w.Part0 = p
  431. w.Part1 = pm
  432. w.C0 = CFrame.new(0, -2.6225, 0)
  433. w.C1 = CFrame.new()
  434. w.Parent = p
  435. local p = Instance.new("Part")
  436. p.Name = "Center 4"
  437. p.FormFactor = "Custom"
  438. p.Size = Vector3.new(1, 1, 1)
  439. p.BrickColor = BrickColor.new("Reddish brown")
  440. p.Material = "Wood"
  441. p.Locked = true
  442. p.TopSurface = 0
  443. p.BottomSurface = 0
  444. p.Parent = model
  445. local m = Instance.new("CylinderMesh")
  446. m.Scale = Vector3.new(0.325, 1.25, 0.325)
  447. m.Parent = p
  448. local w = Instance.new("Weld")
  449. w.Part0 = p
  450. w.Part1 = pm
  451. w.C0 = CFrame.new(0, -3, 0)
  452. w.C1 = CFrame.new()
  453. w.Parent = p
  454. local p = Instance.new("Part")
  455. p.Name = "End 1"
  456. p.FormFactor = "Custom"
  457. p.Size = Vector3.new(1, 1, 1)
  458. p.BrickColor = BrickColor.new("Black")
  459. p.CanCollide = false
  460. p.Locked = true
  461. p.TopSurface = 0
  462. p.BottomSurface = 0
  463. p.Parent = model
  464. local m = Instance.new("CylinderMesh")
  465. m.Scale = Vector3.new(0.31, 0.1, 0.31)
  466. m.Parent = p
  467. local w = Instance.new("Weld")
  468. w.Part0 = p
  469. w.Part1 = pm
  470. w.C0 = CFrame.new(0, -3.625, 0)
  471. w.C1 = CFrame.new()
  472. w.Parent = p
  473. local p = Instance.new("Part")
  474. p.Name = "End 2"
  475. p.FormFactor = "Custom"
  476. p.Size = Vector3.new(1, 1, 1)
  477. p.BrickColor = BrickColor.new("Black")
  478. p.CanCollide = false
  479. p.Locked = true
  480. p.TopSurface = 0
  481. p.BottomSurface = 0
  482. p.Parent = model
  483. local m = Instance.new("SpecialMesh")
  484. m.MeshType = "FileMesh"
  485. m.MeshId = "http://www.roblox.com/Asset/?id=1778999"
  486. m.Scale = Vector3.new(0.425, 0.875, 0.425)
  487. m.Parent = p
  488. local w = Instance.new("Weld")
  489. w.Part0 = p
  490. w.Part1 = pm
  491. w.C0 = CFrame.new(0, 3.61, 0) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0)
  492. w.C1 = CFrame.new()
  493. w.Parent = p
  494. local f = Instance.new("Fire")
  495. f.Enabled = false
  496. f.Name = "Fire"
  497. f.Color = Color3.new(1, 0.5, 0)
  498. f.SecondaryColor = Color3.new(1, 0.75, 0.5)
  499. f.Heat = -25
  500. f.Size = 5
  501. f.Parent = p
  502. local s = Instance.new("Smoke")
  503. s.Enabled = false
  504. s.Name = "Smoke"
  505. s.Opacity = 0.5
  506. s.Color = Color3.new(0.8, 0.8, 0.8)
  507. s.RiseVelocity = -10
  508. s.Size = 5
  509. s.Parent = p
  510. local p = Instance.new("Part")
  511. p.Name = "Muzzle"
  512. p.FormFactor = "Custom"
  513. p.Size = Vector3.new(1, 1, 1)
  514. p.Transparency = 1
  515. p.CanCollide = false
  516. p.Locked = true
  517. p.Parent = model
  518. local w = Instance.new("Weld")
  519. w.Part0 = p
  520. w.Part1 = pm
  521. w.C0 = CFrame.new(0, 0.26, 0)
  522. w.C1 = CFrame.new()
  523. w.Parent = p
  524. local f = Instance.new("Fire")
  525. f.Enabled = false
  526. f.Name = "Fire"
  527. f.Color = Color3.new(1, 0.5, 0)
  528. f.SecondaryColor = Color3.new(1, 0.75, 0.5)
  529. f.Heat = -25
  530. f.Size = 2.5
  531. f.Parent = p
  532. local s = Instance.new("Smoke")
  533. s.Enabled = false
  534. s.Name = "Smoke"
  535. s.Opacity = 0.3
  536. s.Color = Color3.new(0.8, 0.8, 0.8)
  537. s.RiseVelocity = -10
  538. s.Size = 2.5
  539. s.Parent = p
  540. local pm2 = Instance.new("Part")
  541. if magazine.Value <= 0 then pm2.Transparency = 1 end
  542. pm2.Name = "Projectile"
  543. pm2.FormFactor = "Custom"
  544. pm2.Size = Vector3.new(1, 1, 1)
  545. pm2.BrickColor = BrickColor.new("Bright red")
  546. pm2.CanCollide = false
  547. pm2.Locked = true
  548. pm2.TopSurface = 0
  549. pm2.BottomSurface = 0
  550. pm2.Parent = model
  551. local m = Instance.new("CylinderMesh")
  552. m.Scale = Vector3.new(0.2, 1, 0.2)
  553. m.Parent = pm2
  554. local w = Instance.new("Weld")
  555. w.Part0 = pm2
  556. w.Part1 = pm
  557. w.C0 = CFrame.new(0, 0.3, 0)
  558. w.C1 = CFrame.new()
  559. w.Parent = pm2
  560. local f = Instance.new("Fire")
  561. f.Enabled = false
  562. f.Name = "Fire"
  563. f.Color = Color3.new(1, 0.5, 0)
  564. f.SecondaryColor = Color3.new(1, 0.75, 0.5)
  565. f.Heat = 25
  566. f.Size = 1
  567. f.Parent = pm2
  568. local s = Instance.new("Smoke")
  569. s.Enabled = false
  570. s.Name = "Smoke"
  571. s.Opacity = 0.25
  572. s.Color = Color3.new(0.8, 0.8, 0.8)
  573. s.RiseVelocity = 10
  574. s.Size = 5
  575. s.Parent = pm2
  576. local p = Instance.new("Part")
  577. if magazine.Value <= 0 then p.Transparency = 1 end
  578. p.Name = "Projectile Center 1"
  579. p.FormFactor = "Custom"
  580. p.Size = Vector3.new(1, 1, 1)
  581. p.BrickColor = BrickColor.new("Bright red")
  582. p.CanCollide = false
  583. p.Locked = true
  584. p.TopSurface = 0
  585. p.BottomSurface = 0
  586. p.Parent = model
  587. local m = Instance.new("SpecialMesh")
  588. m.MeshType = "FileMesh"
  589. m.MeshId = "http://www.roblox.com/Asset/?id=1033714" --http://www.roblox.com/Asset/?id=1778999
  590. m.Scale = Vector3.new(0.25, 1.25, 0.25)
  591. m.Parent = p
  592. local w = Instance.new("Weld")
  593. w.Part0 = p
  594. w.Part1 = pm2
  595. w.C0 = CFrame.new(0, 0.65, 0)
  596. w.C1 = CFrame.new()
  597. w.Parent = p
  598. local p = Instance.new("Part")
  599. if magazine.Value <= 0 then p.Transparency = 1 end
  600. p.Name = "Projectile Center 2"
  601. p.FormFactor = "Custom"
  602. p.Size = Vector3.new(1, 1, 1)
  603. p.BrickColor = BrickColor.new("Bright red")
  604. p.CanCollide = false
  605. p.Locked = true
  606. p.TopSurface = 0
  607. p.BottomSurface = 0
  608. p.Parent = model
  609. local m = Instance.new("SpecialMesh")
  610. m.MeshType = "FileMesh"
  611. m.MeshId = "http://www.roblox.com/Asset/?id=1033714" --http://www.roblox.com/Asset/?id=1778999
  612. m.Scale = Vector3.new(0.25, 1.1, 0.25)
  613. m.Parent = p
  614. local w = Instance.new("Weld")
  615. w.Part0 = p
  616. w.Part1 = pm2
  617. w.C0 = CFrame.new(0, -1.53, 0) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0)
  618. w.C1 = CFrame.new()
  619. w.Parent = p
  620. local p = Instance.new("Part")
  621. if magazine.Value <= 0 then p.Transparency = 1 end
  622. p.Name = "Projectile Tip"
  623. p.FormFactor = "Custom"
  624. p.Size = Vector3.new(1, 1, 1)
  625. p.BrickColor = BrickColor.new("Bright red")
  626. p.CanCollide = false
  627. p.Locked = true
  628. p.TopSurface = 0
  629. p.BottomSurface = 0
  630. p.Parent = model
  631. local m = Instance.new("CylinderMesh")
  632. m.Scale = Vector3.new(0.1, 0.1, 0.1)
  633. m.Parent = p
  634. local w = Instance.new("Weld")
  635. w.Part0 = p
  636. w.Part1 = pm2
  637. w.C0 = CFrame.new(0, 1.89, 0)
  638. w.C1 = CFrame.new()
  639. w.Parent = p
  640. return model
  641. end
  642.  
  643.  
  644. function removeParts(format)
  645. if format == "RightHand" then
  646. pcall(function() Player.Character[Name]:Remove() end)
  647. elseif format == "LeftHand" then
  648. pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
  649. elseif format == "RightHolster" then
  650. pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
  651. elseif format == "LeftHolster" then
  652. pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
  653. end
  654. end
  655.  
  656.  
  657. function SetAngle(Joint, Angle, Character)
  658. if Character == nil then return false end
  659. local Joints = {
  660. Character.Torso:FindFirstChild("Right Shoulder 2"),
  661. Character.Torso:FindFirstChild("Left Shoulder 2"),
  662. Character.Torso:FindFirstChild("Right Hip 2"),
  663. Character.Torso:FindFirstChild("Left Hip 2")
  664. }
  665. if Joints[Joint] == nil then return false end
  666. if Joint == 1 or Joint == 3 then
  667. Joints[Joint].DesiredAngle = Angle
  668. end
  669. if Joint == 2 or Joint == 4 then
  670. Joints[Joint].DesiredAngle = -Angle
  671. end
  672. end
  673.  
  674.  
  675. function ForceAngle(Joint, Angle, Character)
  676. if Character == nil then return false end
  677. local Joints = {
  678. Character.Torso:FindFirstChild("Right Shoulder 2"),
  679. Character.Torso:FindFirstChild("Left Shoulder 2"),
  680. Character.Torso:FindFirstChild("Right Hip 2"),
  681. Character.Torso:FindFirstChild("Left Hip 2")
  682. }
  683. if Joints[Joint] == nil then return false end
  684. if Joint == 1 or Joint == 3 then
  685. Joints[Joint].DesiredAngle = Angle
  686. Joints[Joint].CurrentAngle = Angle
  687. end
  688. if Joint == 2 or Joint == 4 then
  689. Joints[Joint].DesiredAngle = -Angle
  690. Joints[Joint].CurrentAngle = -Angle
  691. end
  692. end
  693.  
  694.  
  695. function SetSpeed(Joint, Speed, Character)
  696. if Character == nil then return false end
  697. local Joints = {
  698. Character.Torso:FindFirstChild("Right Shoulder 2"),
  699. Character.Torso:FindFirstChild("Left Shoulder 2"),
  700. Character.Torso:FindFirstChild("Right Hip 2"),
  701. Character.Torso:FindFirstChild("Left Hip 2")
  702. }
  703. if Joints[Joint] == nil then return false end
  704. Joints[Joint].MaxVelocity = Speed
  705. end
  706.  
  707.  
  708. function DisableLimb(Limb, Character)
  709. if Character == nil then return false end
  710. if Character:FindFirstChild("Torso") == nil then return false end
  711. local Joints = {
  712. Character.Torso:FindFirstChild("Right Shoulder"),
  713. Character.Torso:FindFirstChild("Left Shoulder"),
  714. Character.Torso:FindFirstChild("Right Hip"),
  715. Character.Torso:FindFirstChild("Left Hip")
  716. }
  717. local Limbs = {
  718. Character:FindFirstChild("Right Arm"),
  719. Character:FindFirstChild("Left Arm"),
  720. Character:FindFirstChild("Right Leg"),
  721. Character:FindFirstChild("Left Leg")
  722. }
  723. if Joints[Limb] == nil then return false end
  724. if Limbs[Limb] == nil then return false end
  725. local Joint = Instance.new("Motor")
  726. Joint.Parent = Character.Torso
  727. Joint.Part0 = Character.Torso
  728. Joint.Part1 = Limbs[Limb]
  729. if Limb == 1 then
  730. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  731. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  732. Joint.Name = "Right Shoulder 2"
  733. elseif Limb == 2 then
  734. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  735. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  736. Joint.Name = "Left Shoulder 2"
  737. elseif Limb == 3 then
  738. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  739. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  740. Joint.Name = "Right Hip 2"
  741. elseif Limb == 4 then
  742. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  743. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  744. Joint.Name = "Left Hip 2"
  745. end
  746. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  747. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  748. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  749. Joints[Limb]:Remove()
  750. end
  751.  
  752.  
  753. function ResetLimbCFrame(Limb, Character)
  754. if Character == nil then return false end
  755. if Character.Parent == nil then return false end
  756. if Character:FindFirstChild("Torso") == nil then return false end
  757. local Joints = {
  758. Character.Torso:FindFirstChild("Right Shoulder 2"),
  759. Character.Torso:FindFirstChild("Left Shoulder 2"),
  760. Character.Torso:FindFirstChild("Right Hip 2"),
  761. Character.Torso:FindFirstChild("Left Hip 2")
  762. }
  763. local Limbs = {
  764. Character:FindFirstChild("Right Arm"),
  765. Character:FindFirstChild("Left Arm"),
  766. Character:FindFirstChild("Right Leg"),
  767. Character:FindFirstChild("Left Leg")
  768. }
  769. if Joints[Limb] == nil then return false end
  770. if Limbs[Limb] == nil then return false end
  771. if Limb == 1 then
  772. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  773. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  774. elseif Limb == 2 then
  775. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  776. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  777. elseif Limb == 3 then
  778. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  779. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  780. elseif Limb == 4 then
  781. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  782. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  783. end
  784. end
  785.  
  786.  
  787. function EnableLimb(Limb, Character)
  788. if Character == nil then return false end
  789. if Character:FindFirstChild("Torso") == nil then return false end
  790. local Joints = {
  791. Character.Torso:FindFirstChild("Right Shoulder 2"),
  792. Character.Torso:FindFirstChild("Left Shoulder 2"),
  793. Character.Torso:FindFirstChild("Right Hip 2"),
  794. Character.Torso:FindFirstChild("Left Hip 2")
  795. }
  796. local Limbs = {
  797. Character:FindFirstChild("Right Arm"),
  798. Character:FindFirstChild("Left Arm"),
  799. Character:FindFirstChild("Right Leg"),
  800. Character:FindFirstChild("Left Leg")
  801. }
  802. if Joints[Limb] == nil then return false end
  803. if Limbs[Limb] == nil then return false end
  804. if Limb == 1 then
  805. Joints[Limb].Name = "Right Shoulder"
  806. elseif Limb == 2 then
  807. Joints[Limb].Name = "Left Shoulder"
  808. elseif Limb == 3 then
  809. Joints[Limb].Name = "Right Hip"
  810. elseif Limb == 4 then
  811. Joints[Limb].Name = "Left Hip"
  812. end
  813. Animate = Character:FindFirstChild("Animate")
  814. if Animate == nil then return false end
  815. Animate = Animate:Clone()
  816. Character.Animate:Remove()
  817. Animate.Parent = Character
  818. end
  819.  
  820.  
  821. function playAnimation(format, mouse)
  822. if format == "equip" then
  823. coroutine.resume(coroutine.create(function()
  824. for i = 0, 1, 0.025 do
  825. if Player.Character:FindFirstChild("Torso") ~= nil then
  826. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  827. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, math.rad(67.5) * i)
  828. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0)
  829. else return false end
  830. else return false end
  831. wait()
  832. end
  833. end))
  834. for i = 0, 1, 0.05 do
  835. if Player.Character:FindFirstChild("Torso") ~= nil then
  836. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  837. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, -0.25 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * i, 0, math.rad(-20) * i)
  838. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0)
  839. else return false end
  840. else return false end
  841. wait()
  842. end
  843. removeParts("RightHolster")
  844. makeParts("RightHand")
  845. for i = 0, 1, 0.05 do
  846. if Player.Character:FindFirstChild("Torso") ~= nil then
  847. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  848. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 * (1 - i), 0.5 * (1 - i), -0.25 * (1 - i)) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, math.rad(-20) * (1 - i)) * CFrame.new(1.25 * i, 0.5 * i, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, 0)
  849. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 0.75 * i, 0.1 * i)
  850. else return false end
  851. else return false end
  852. if Player.Character:FindFirstChild(Name) ~= nil then
  853. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  854. Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 1.5, 0.75)
  855. Player.Character[Name].Handle.Weld.C1 = CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, 0)
  856. else return false end
  857. else return false end
  858. wait()
  859. end
  860. makeParts("RightHolster")
  861. removeParts("RightHand")
  862. return playAnimation("hold")
  863. end
  864. if format == "unequip" then
  865. coroutine.resume(coroutine.create(function()
  866. for i = 1, 0, -0.025 do
  867. if Player.Character:FindFirstChild("Torso") ~= nil then
  868. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  869. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, math.rad(67.5) * i)
  870. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0)
  871. else return false end
  872. else return false end
  873. wait()
  874. end
  875. end))
  876. for i = 1, 0, -0.05 do
  877. if Player.Character:FindFirstChild("Torso") ~= nil then
  878. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  879. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 * (1 - i), 0.5 * (1 - i), -0.25 * (1 - i)) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, math.rad(-20) * (1 - i)) * CFrame.new(1.25 * i, 0.5 * i, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, 0)
  880. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 0.75 * i, 0.1 * i)
  881. else return false end
  882. else return false end
  883. if Player.Character:FindFirstChild(Name) ~= nil then
  884. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  885. Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 1.5, 0.75)
  886. Player.Character[Name].Handle.Weld.C1 = CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, 0)
  887. else return false end
  888. else return false end
  889. wait()
  890. end
  891. makeParts("RightHolster")
  892. removeParts("RightHand")
  893. for i = 1, 0, -0.05 do
  894. if Player.Character:FindFirstChild("Torso") ~= nil then
  895. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  896. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, -0.25 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * i, 0, math.rad(-20) * i)
  897. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0)
  898. else return false end
  899. else return false end
  900. wait()
  901. end
  902. removeParts("RightHolster")
  903. makeParts("RightHand")
  904. return true
  905. end
  906. if format == "hold" then
  907. if Player.Character:FindFirstChild("Torso") ~= nil then
  908. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  909. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(67.5))
  910. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 1.85, 0)
  911. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  912. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.75, 0.1)
  913. else return false end
  914. else return false end
  915. end
  916. if format == "reload" then
  917. Player.Character[Name].Handle.Reload.Volume = 0
  918. Player.Character[Name].Handle.Reload.Pitch = 1.78
  919. Player.Character[Name].Handle.Reload:Play()
  920. coroutine.resume(coroutine.create(function()
  921. for i = 0, 1, 0.06 do
  922. if Player.Character:FindFirstChild("Torso") ~= nil and Player.Character:FindFirstChild(Name) ~= nil then
  923. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil and Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  924. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25 + i / 10, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(i * 90))
  925. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.75, 0.1)
  926. Player.Character[Name].Handle.Weld.C1 = CFrame.new(0, -1.4 * i, 0) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(-i * 170))
  927. end
  928. end
  929. wait()
  930. end
  931. end))
  932. for i = 1, 0, -0.1 do
  933. if Player.Character:FindFirstChild("Torso") ~= nil then
  934. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  935. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, math.rad(67.5) * i)
  936. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0)
  937. else return false end
  938. else return false end
  939. wait()
  940. end
  941. local projectile = Instance.new("Model")
  942. projectile.Name = Name.. " Projectile"
  943. local source = Player.Character[Name]:FindFirstChild("Projectile")
  944. if source == nil then return end
  945. source = source:Clone()
  946. source.Transparency = 0
  947. source.Parent = projectile
  948. for _, Part in pairs(Player.Character[Name]:GetChildren()) do
  949. if string.match(Part.Name, "Projectile") and Part.Name ~= "Projectile" then
  950. local new = Part:Clone()
  951. new.Parent = projectile
  952. new.Transparency = 0
  953. --new.CFrame = source.CFrame * (Part.Weld.C0 * Part.Weld.C1):inverse()
  954. local w = Instance.new("Weld", new)
  955. w.Part0 = w.Parent
  956. w.Part1 = source
  957. w.C0 = Part.Weld.C0
  958. w.C1 = Part.Weld.C1
  959. end
  960. end
  961. local w = Instance.new("Weld", source)
  962. w.Part0 = w.Parent
  963. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  964. w.C0 = CFrame.new(0.2, -0.8, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, math.rad(-37.5))
  965. projectile.Parent = Player.Character[Name]
  966. for i = 0, 1, 0.1 do
  967. if Player.Character:FindFirstChild("Torso") ~= nil then
  968. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  969. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(110) * i, 0, math.rad(67.5) * i)
  970. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0.35 * i, 1.85 * i, 0)
  971. else return false end
  972. else return false end
  973. wait()
  974. end
  975. Player.Character[Name].Handle.Reload.Volume = 1
  976. Player.Character[Name].Handle.Reload.Pitch = 0.9
  977. for i = 0, 0.9, 0.1 do
  978. if Player.Character:FindFirstChild("Torso") ~= nil then
  979. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  980. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5 + i, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(110), 0, math.rad(67.5))
  981. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.35 * (1 - i), 1.85, 0)
  982. else return false end
  983. else return false end
  984. wait()
  985. end
  986. projectile:Remove()
  987. Player.Character[Name].Handle.Reload:Stop()
  988. for _, Part in pairs(Player.Character[Name]:GetChildren()) do
  989. if string.match(Part.Name, "Projectile") then
  990. Part.Transparency = 0
  991. end
  992. end
  993. coroutine.resume(coroutine.create(function()
  994. for i = 1, 0, -0.1 do
  995. if Player.Character:FindFirstChild("Torso") ~= nil and Player.Character:FindFirstChild(Name) ~= nil then
  996. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil and Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  997. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25 + i / 10, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(i * 90))
  998. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.75, 0.1)
  999. Player.Character[Name].Handle.Weld.C1 = CFrame.new(0, -1.4 * i, 0) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(-i * 170))
  1000. end
  1001. end
  1002. wait()
  1003. end
  1004. end))
  1005. for i = 0.9, 0, -0.1 do
  1006. if Player.Character:FindFirstChild("Torso") ~= nil then
  1007. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1008. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5 + i, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(110), 0, math.rad(67.5))
  1009. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 1.85, 0)
  1010. else return false end
  1011. else return false end
  1012. wait()
  1013. end
  1014. Player.Character[Name].Handle.Weld.C1 = CFrame.new()
  1015. playAnimation("hold")
  1016. return true
  1017. end
  1018. if format == "fire" then
  1019. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  1020. Player.Character[Name].Handle.Fire:Play()
  1021. CamShake(0.1, 5000)
  1022. else return false end
  1023. if Player.Character:FindFirstChild("Humanoid") ~= nil then
  1024. coroutine.resume(coroutine.create(function() if Player.Character.Humanoid.PlatformStand == false and Player.Character.Humanoid.Sit == false then Player.Character.Humanoid.PlatformStand = true wait(0.1) Player.Character.Humanoid.PlatformStand = false end end))
  1025. else return false end
  1026. if Player.Character:FindFirstChild("Torso") ~= nil then
  1027. coroutine.resume(coroutine.create(function() Player.Character.Torso.Velocity = Player.Character.Torso.Velocity + (Player.Character.Torso.CFrame.lookVector * -100) + Vector3.new(0, 25, 0) end))
  1028. else return false end
  1029. if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  1030. coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.5) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end))
  1031. else return false end
  1032. if Player.Character[Name]:FindFirstChild("End 2") ~= nil then
  1033. coroutine.resume(coroutine.create(function() Player.Character[Name]["End 2"].Smoke.Enabled = true Player.Character[Name]["End 2"].Fire.Enabled = true wait(0.5) Player.Character[Name]["End 2"].Smoke.Enabled = false Player.Character[Name]["End 2"].Fire.Enabled = false end))
  1034. else return false end
  1035. end
  1036. return true
  1037. end
  1038.  
  1039.  
  1040. function CamShake(time, freq)
  1041. coroutine.resume(coroutine.create(function()
  1042. local cam = Workspace.CurrentCamera
  1043. local time = 10
  1044. local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
  1045. if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
  1046. if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
  1047. cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(seed.x * time, seed.y * time, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
  1048. for i = 1, time do
  1049. cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(-seed.x, -seed.y, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
  1050. wait()
  1051. end
  1052. end))
  1053. end
  1054.  
  1055.  
  1056. function Weld(x, y)
  1057. local weld = Instance.new("Weld")
  1058. weld.Part0 = x
  1059. weld.Part1 = y
  1060. CJ = CFrame.new(x.Position)
  1061. C0 = x.CFrame:inverse() * CJ
  1062. C1 = y.CFrame:inverse() * CJ
  1063. weld.C0 = C0
  1064. weld.C1 = C1
  1065. weld.Parent = x
  1066. end
  1067.  
  1068.  
  1069. function tagHumanoid(humanoid)
  1070. local tag = Instance.new("ObjectValue")
  1071. tag.Name = "creator"
  1072. tag.Value = Player
  1073. tag.Parent = humanoid
  1074. local tag = Instance.new("StringValue")
  1075. tag.Name = "creatorType1"
  1076. tag.Value = Name
  1077. tag.Parent = humanoid
  1078. local tag = Instance.new("StringValue")
  1079. tag.Name = "creatorType2"
  1080. tag.Value = "blown to bits"
  1081. tag.Parent = humanoid
  1082. end
  1083.  
  1084.  
  1085. function untagHumanoid(humanoid)
  1086. if humanoid ~= nil then
  1087. local tag = humanoid:FindFirstChild("creator")
  1088. if tag ~= nil then
  1089. tag:Remove()
  1090. end
  1091. local tag = humanoid:FindFirstChild("creatorType1")
  1092. if tag ~= nil then
  1093. tag:Remove()
  1094. end
  1095. local tag = humanoid:FindFirstChild("creatorType2")
  1096. if tag ~= nil then
  1097. tag:Remove()
  1098. end
  1099. end
  1100. end
  1101.  
  1102.  
  1103. function fire(startPoint, endPoint, hit)
  1104. local projectile = Instance.new("Model")
  1105. projectile.Name = Name.. " Projectile"
  1106. local source = Player.Character[Name]:FindFirstChild("Projectile")
  1107. if source == nil then return end
  1108. source.Transparency = 1
  1109. source = source:Clone()
  1110. source.Transparency = 0
  1111. source.CanCollide = false
  1112. pcall(function() source.Fire.Enabled = true end)
  1113. pcall(function() source.Smoke.Enabled = true end)
  1114. source.CFrame = CFrame.new(startPoint, endPoint) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  1115. source.Parent = projectile
  1116. for _, Part in pairs(Player.Character[Name]:GetChildren()) do
  1117. if string.match(Part.Name, "Projectile") and Part.Name ~= "Projectile" then
  1118. local new = Part:Clone()
  1119. new.Parent = projectile
  1120. new.Transparency = 0
  1121. new.CFrame = source.CFrame * (Part.Weld.C0 * Part.Weld.C1):inverse()
  1122. local w = Instance.new("Weld", new)
  1123. w.Part0 = w.Parent
  1124. w.Part1 = source
  1125. w.C0 = Part.Weld.C0
  1126. w.C1 = Part.Weld.C1
  1127. Part.Transparency = 1
  1128. end
  1129. end
  1130. projectile.Parent = Workspace
  1131. local vel = Instance.new("BodyVelocity")
  1132. vel.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  1133. vel.velocity = (endPoint - startPoint).unit * 100
  1134. vel.Parent = source
  1135. local gyro = Instance.new("BodyGyro")
  1136. gyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  1137. gyro.cframe = CFrame.new(startPoint, endPoint) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  1138. gyro.Parent = source
  1139. coroutine.resume(coroutine.create(function() wait(1) gyro:Remove() end))
  1140. wait(0.2)
  1141. source.CanCollide = true
  1142. local connection = nil
  1143. connection = source.Touched:connect(function()
  1144. if hit.Parent == nil then return end
  1145. if hit.Parent == projectile then return end
  1146. if hit.Parent == Player.Character then return end
  1147. if hit.Parent == Player.Character:FindFirstChild(Name) then return end
  1148. if hit.Parent.Parent == Player.Character then return end
  1149. for i = 1, math.random(3, 6) do
  1150. local s = Instance.new("Sound", source)
  1151. s.SoundId = "http://www.roblox.com/Asset/?id=2101148"
  1152. s.Volume = 1
  1153. s.Pitch = math.random(1, 10) / 10
  1154. s:Play()
  1155. end
  1156. coroutine.resume(coroutine.create(function()
  1157. pcall(function() vel:Remove() end)
  1158. for _, Part in pairs(projectile:GetChildren()) do
  1159. if Part.Name ~= "Projectile" then
  1160. Part:Remove()
  1161. else
  1162. Part.Anchored = true
  1163. Part.Transparency = 1
  1164. Part.CanCollide = false
  1165. pcall(function() Part.Fire.Enabled = false end)
  1166. pcall(function() Part.Smoke.Enabled = false end)
  1167. end
  1168. end
  1169. connection:disconnect()
  1170. wait(5)
  1171. projectile:Remove()
  1172. end))
  1173. local range = damage / 5
  1174. local power = damage / 2
  1175. local function Push(Part)
  1176. if #Part:GetChildren() > 0 then for _, Parts in pairs(Part:GetChildren()) do Push(Parts) end end
  1177. if pcall(function() local x = Part.CFrame end) == false then return end
  1178. if Part.Anchored == true then return end
  1179. if (Part.Position - source.Position).magnitude > range then return end
  1180. Part.Velocity = Part.Velocity + ((Part.Position - source.Position).unit * power)
  1181. coroutine.wrap(function()
  1182. if Part.Parent:FindFirstChild("Humanoid") ~= nil then
  1183. Part.Parent.Humanoid:TakeDamage(1000000) --Set to damage of explosion
  1184. end
  1185. end)()
  1186. end
  1187. Push(Workspace)
  1188. for i = 1, math.random(5, 20) do
  1189. local blast = Instance.new("Part")
  1190. blast.FormFactor = 0
  1191. blast.Size = Vector3.new(1, 1, 1)
  1192. local color = math.random(1, 4)
  1193. if color == 1 then
  1194. blast.BrickColor = BrickColor.new("Really red")
  1195. elseif color == 2 then
  1196. blast.BrickColor = BrickColor.new("Bright orange")
  1197. elseif color == 3 then
  1198. blast.BrickColor = BrickColor.new("Neon orange")
  1199. elseif color == 4 then
  1200. blast.BrickColor = BrickColor.new("Bright red")
  1201. end
  1202. blast.TopSurface = 0
  1203. blast.BottomSurface = 0
  1204. blast.Anchored = true
  1205. blast.CanCollide = false
  1206. blast.CFrame = source.CFrame * CFrame.new(math.random(-damage / 50, damage / 50), math.random(-damage / 50, damage / 50), math.random(-damage / 50, damage / 50))
  1207. blast.Parent = Workspace
  1208. local mesh = Instance.new("SpecialMesh")
  1209. mesh.MeshType = "Sphere"
  1210. mesh.Parent = blast
  1211. coroutine.resume(coroutine.create(function()
  1212. for i = 1, range, math.random(range, range + 100) / 100 do
  1213. blast.Transparency = i / range
  1214. mesh.Scale = Vector3.new(i, i, i)
  1215. wait()
  1216. end
  1217. blast:Remove()
  1218. end))
  1219. end
  1220. end)
  1221. coroutine.resume(coroutine.create(function()
  1222. wait(10)
  1223. for _, Part in pairs(projectile:GetChildren()) do
  1224. Part.CanCollide = false
  1225. end
  1226. pcall(function() source.Fire.Enabled = false end)
  1227. pcall(function() source.Smoke.Enabled = false end)
  1228. pcall(function() vel:Remove() end)
  1229. pcall(function() connection:disconnect() end)
  1230. end))
  1231. end
  1232.  
  1233.  
  1234. function onButton1Down(mouse)
  1235. if selected == false then return end
  1236. if Player.Character:FindFirstChild(Name) ~= nil and Button1Down == false and canFire == true and (function() if dual == true then if Player.Character:FindFirstChild(Name.. " (Left)") ~= nil then return true else return false end else return true end end)() == true then
  1237. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  1238. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1239. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
  1240. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
  1241. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1242. Button1Down = true
  1243. canFire = false
  1244. canFire2 = true
  1245. while canFire2 == true do
  1246. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1247. if humanoid == nil then
  1248. canFire2 = false
  1249. break
  1250. end
  1251. if humanoid.Health <= 0 then
  1252. canFire2 = false
  1253. break
  1254. end
  1255. local fireLeft = false
  1256. if automatic == false and burst == false then
  1257. canFire2 = false
  1258. elseif automatic == false and burst == true then
  1259. if burstCount >= burstCountMax then
  1260. canFire2 = false
  1261. burstCount = 0
  1262. break
  1263. end
  1264. burstCount = burstCount + 1
  1265. elseif automatic == true and burst == false then
  1266. fireLeft = true
  1267. end
  1268. if magazine.Value > 0 then
  1269. magazine.Value = magazine.Value - 1
  1270. updateGui()
  1271. fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1272. coroutine.resume(coroutine.create(function()
  1273. if dual == true then
  1274. playAnimation("rightFire")
  1275. elseif dual == false then
  1276. playAnimation("fire")
  1277. end
  1278. end))
  1279. else
  1280. Player.Character[Name].Handle.Empty:Play()
  1281. end
  1282. if fireLeft == true and dual == true and automatic == true then
  1283. if magazine.Value > 0 then
  1284. coroutine.resume(coroutine.create(function()
  1285. wait(readyTime / 2)
  1286. magazine.Value = magazine.Value - 1
  1287. updateGui()
  1288. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1289. playAnimation("leftFire")
  1290. end))
  1291. else
  1292. coroutine.resume(coroutine.create(function()
  1293. wait(readyTime / 2)
  1294. Player.Character[Name].Handle.Empty:Play()
  1295. end))
  1296. end
  1297. end
  1298. wait(readyTime)
  1299. end
  1300. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1301. canFire = true
  1302. end
  1303. end
  1304.  
  1305.  
  1306. function onButton1Up(mouse)
  1307. if selected == false then return end
  1308. Button1Down = false
  1309. canFire2 = false
  1310. burstCount = 0
  1311. while canFire == false do wait() end
  1312. if dual == true and automatic == false then
  1313. if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
  1314. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1315. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1316. canFire = false
  1317. canFire2 = true
  1318. while canFire2 == true do
  1319. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1320. if humanoid == nil then
  1321. canFire2 = false
  1322. break
  1323. end
  1324. if humanoid.Health <= 0 then
  1325. canFire2 = false
  1326. break
  1327. end
  1328. if burst == false then
  1329. canFire2 = false
  1330. elseif burst == true then
  1331. if burstCount >= burstCountMax then
  1332. canFire2 = false
  1333. burstCount = 0
  1334. break
  1335. end
  1336. burstCount = burstCount + 1
  1337. end
  1338. if magazine.Value <= 0 then
  1339. Player.Character[Name].Handle.Empty:Play()
  1340. else
  1341. coroutine.resume(coroutine.create(function()
  1342. playAnimation("leftFire")
  1343. end))
  1344. magazine.Value = magazine.Value - 1
  1345. updateGui()
  1346. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1347. end
  1348. wait(readyTime)
  1349. end
  1350. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1351. canFire = true
  1352. end
  1353. end
  1354.  
  1355.  
  1356. function onKeyDown(key, mouse)
  1357. if selected == false then return end
  1358. key = key:lower()
  1359. if key == "q" and Button1Down == false and canFire == true then
  1360. if mouse.Target == nil then return end
  1361. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  1362. if dual == true then onKeyDown("t", mouse) end
  1363. onDeselected(mouse)
  1364. removeParts("RightHolster")
  1365. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  1366. end
  1367. end
  1368. if key == "e" and Button1Down == false and canFire == true and canSilence == true then
  1369. if silenced then
  1370. silenced = false
  1371. if Player.Character:FindFirstChild(Name) == nil then return end
  1372. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1373. if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
  1374. Player.Character[Name].Muzzle.Transparency = 1
  1375. Player.Character[Name].Muzzle.Name = "Silencer"
  1376. Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
  1377. if dual == true then
  1378. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1379. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
  1380. Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
  1381. Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
  1382. Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
  1383. end
  1384. else
  1385. silenced = true
  1386. if Player.Character:FindFirstChild(Name) == nil then return end
  1387. if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
  1388. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1389. Player.Character[Name].Silencer.Transparency = 0
  1390. Player.Character[Name].Muzzle.Name = "Muzzle 2"
  1391. Player.Character[Name].Silencer.Name = "Muzzle"
  1392. if dual == true then
  1393. if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
  1394. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1395. Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
  1396. Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
  1397. Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
  1398. end
  1399. end
  1400. end
  1401. if key == "r" and Button1Down == false and canFire == true then
  1402. if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then
  1403. canFire = false
  1404. burstCount = 0
  1405. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1406. if magazine.Value > 0 then ammo.Value = ammo.Value + magazine.Value magazine.Value = 0 end
  1407. updateGui()
  1408. if dual == true then
  1409. playAnimation("reloadDual")
  1410. elseif dual == false then
  1411. playAnimation("reload")
  1412. end
  1413. if ammo.Value - magazineMax.Value < 0 then
  1414. magazine.Value = ammo.Value
  1415. ammo.Value = 0
  1416. elseif ammo.Value - magazineMax.Value >= 0 then
  1417. ammo.Value = ammo.Value - magazineMax.Value
  1418. magazine.Value = magazineMax.Value
  1419. end
  1420. updateGui()
  1421. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1422. canFire = true
  1423. end
  1424. end
  1425. if key == "t" and Button1Down == false and canFire == true and canDual == true then
  1426. canFire = false
  1427. if dual == false then
  1428. local weapon = nil
  1429. for _, p in pairs(Player.Backpack:GetChildren()) do
  1430. if p.Name == Name and p ~= script.Parent then weapon = p break end
  1431. end
  1432. if weapon ~= nil then
  1433. dual = true
  1434. weapon.Name = "Dual"
  1435. weapon.Parent = script
  1436. silenced = false
  1437. removeParts("RightHand")
  1438. makeParts("RightHand")
  1439. removeParts("RightHolster")
  1440. makeParts("LeftHolster")
  1441. playAnimation("leftEquip")
  1442. removeParts("LeftHolster")
  1443. makeParts("LeftHand")
  1444. magazineMax.Value = math.ceil(magazineMax.Value * 2)
  1445. ammoMax.Value = math.ceil(ammoMax.Value * 2)
  1446. magazine.Value = magazine.Value + weapon.Magazine.Value
  1447. ammo.Value = ammo.Value + weapon.Ammo.Value
  1448. updateGui()
  1449. end
  1450. elseif dual == true then
  1451. local weapon = script:FindFirstChild("Dual")
  1452. if weapon ~= nil then
  1453. dual = false
  1454. weapon.Name = Name
  1455. weapon.Parent = Player.Backpack
  1456. silenced = false
  1457. removeParts("RightHand")
  1458. makeParts("RightHand")
  1459. playAnimation("leftUnequip")
  1460. removeParts("LeftHand")
  1461. makeParts("RightHolster")
  1462. playAnimation("hold")
  1463. weapon.Magazine.Value = math.floor(magazine.Value / 2)
  1464. weapon.Ammo.Value = math.floor(ammo.Value / 2)
  1465. magazineMax.Value = math.ceil(magazineMax.Value / 2)
  1466. ammoMax.Value = math.ceil(ammoMax.Value / 2)
  1467. magazine.Value = math.ceil(magazine.Value / 2)
  1468. ammo.Value = math.ceil(ammo.Value / 2)
  1469. updateGui()
  1470. end
  1471. end
  1472. canFire = true
  1473. end
  1474. if key == "y" and canZoom == true then
  1475. if zoom == false then
  1476. zoom = true
  1477. local pos = mouse.Hit.p
  1478. local target = mouse.Target
  1479. local cam = Workspace.CurrentCamera
  1480. focus = Instance.new("Part", Workspace)
  1481. focus.Anchored = true
  1482. focus.CanCollide = false
  1483. focus.Transparency = 1
  1484. focus.TopSurface = 0
  1485. focus.BottomSurface = 0
  1486. focus.FormFactor = "Plate"
  1487. focus.Size = Vector3.new(0, 0, 0)
  1488. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p)
  1489. cam.CameraSubject = focus
  1490. cam.CameraType = "Attach"
  1491. while zoom == true and selected == true do
  1492. local set = false
  1493. if target ~= nil then
  1494. if target.Parent ~= nil then
  1495. if target.Anchored == false then
  1496. focus.CFrame = CFrame.new(target.Position) * (CFrame.new(Player.Character.Torso.Position, target.Position) - CFrame.new(Player.Character.Torso.Position, target.Position).p)
  1497. set = true
  1498. end
  1499. end
  1500. end
  1501. if set == false then
  1502. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p)
  1503. end
  1504. wait()
  1505. end
  1506. if focus ~= nil then focus:Remove() focus = nil end
  1507. local cam = Workspace.CurrentCamera
  1508. cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
  1509. cam.CameraType = "Custom"
  1510. else
  1511. zoom = false
  1512. end
  1513. end
  1514. if key == "u" and Button1Down == false and canFire == true then
  1515. if automatic == false and burst == false then
  1516. if switchToBurst == true then
  1517. burst = true
  1518. local m = Instance.new("Message", Player)
  1519. m.Text = "Burst"
  1520. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1521. delay(2.5, function() m:Remove() end)
  1522. elseif switchToAutomatic == true then
  1523. automatic = true
  1524. local m = Instance.new("Message", Player)
  1525. m.Text = "Automatic"
  1526. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1527. delay(2.5, function() m:Remove() end)
  1528. end
  1529. elseif automatic == false and burst == true then
  1530. if switchToAutomatic == true then
  1531. automatic = true
  1532. burst = false
  1533. local m = Instance.new("Message", Player)
  1534. m.Text = "Automatic"
  1535. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1536. delay(2.5, function() m:Remove() end)
  1537. elseif switchToSingle == true then
  1538. burst = false
  1539. local m = Instance.new("Message", Player)
  1540. m.Text = "Single"
  1541. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1542. delay(2.5, function() m:Remove() end)
  1543. end
  1544. elseif automatic == true and burst == false then
  1545. if switchToSingle == true then
  1546. automatic = false
  1547. local m = Instance.new("Message", Player)
  1548. m.Text = "Single"
  1549. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1550. delay(2.5, function() m:Remove() end)
  1551. elseif switchToBurst == true then
  1552. automatic = false
  1553. burst = true
  1554. local m = Instance.new("Message", Player)
  1555. m.Text = "Burst"
  1556. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1557. delay(2.5, function() m:Remove() end)
  1558. end
  1559. end
  1560. end
  1561. end
  1562.  
  1563.  
  1564. function onSelected(mouse)
  1565. if selected == true then return end
  1566. selected = true
  1567. canFire = false
  1568. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1569. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1570. if Player.Character.WeaponActivated.Value == nil then break end
  1571. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1572. wait()
  1573. end
  1574. updateGui()
  1575. local weapon = Instance.new("ObjectValue")
  1576. weapon.Name = "WeaponActivated"
  1577. weapon.Value = script.Parent
  1578. weapon.Parent = Player.Character
  1579. DisableLimb(1, Player.Character)
  1580. DisableLimb(2, Player.Character)
  1581. ForceAngle(1, 0, Player.Character)
  1582. ForceAngle(2, 0, Player.Character)
  1583. if dual == true then
  1584. coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
  1585. playAnimation("rightEquip")
  1586. removeParts("LeftHolster")
  1587. makeParts("LeftHand")
  1588. else
  1589. playAnimation("equip")
  1590. end
  1591. removeParts("RightHolster")
  1592. makeParts("RightHand")
  1593. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  1594. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  1595. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  1596. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1597. canFire = true
  1598. end
  1599.  
  1600.  
  1601. function onDeselected(mouse)
  1602. if selected == false then return end
  1603. Button1Down = false
  1604. while canFire == false do
  1605. wait()
  1606. end
  1607. selected = false
  1608. if dual == true then
  1609. if math.random(1, 2) == 1 then
  1610. coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
  1611. wait(math.random(1, 10) / 10)
  1612. playAnimation("rightUnequip")
  1613. else
  1614. coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
  1615. wait(math.random(1, 10) / 10)
  1616. playAnimation("leftUnequip")
  1617. end
  1618. removeParts("LeftHand")
  1619. makeParts("LeftHolster")
  1620. else
  1621. playAnimation("unequip")
  1622. end
  1623. removeParts("RightHand")
  1624. makeParts("RightHolster")
  1625. ForceAngle(1, 0, Player.Character)
  1626. ForceAngle(2, 0, Player.Character)
  1627. ResetLimbCFrame(1, Player.Character)
  1628. ResetLimbCFrame(2, Player.Character)
  1629. EnableLimb(1, Player.Character)
  1630. EnableLimb(2, Player.Character)
  1631. silenced = false
  1632. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  1633. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  1634. if Player.Character.WeaponActivated.Value == script.Parent then
  1635. Player.Character.WeaponActivated:Remove()
  1636. end
  1637. end
  1638. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1639. if Player.Character.WeaponActivated.Value == nil then break end
  1640. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1641. wait()
  1642. end
  1643. end
  1644.  
  1645.  
  1646. if script.Parent.ClassName ~= "HopperBin" then
  1647. if Player == nil then print("Error: Player not found!") return end
  1648. Tool = Instance.new("HopperBin")
  1649. Tool.Name = Name
  1650. Tool.Parent = Player.Backpack
  1651. script.Name = "Main"
  1652. script.Parent = Tool
  1653. elseif script.Parent.ClassName == "HopperBin" then
  1654. while script.Parent.Parent.ClassName ~= "Backpack" do
  1655. wait()
  1656. end
  1657. if script.Parent:FindFirstChild("MagazineMax") == nil then
  1658. magazineMax = Instance.new("NumberValue")
  1659. magazineMax.Name = "MagazineMax"
  1660. magazineMax.Value = 3
  1661. magazineMax.Parent = script.Parent
  1662. else
  1663. magazineMax = script.Parent.MagazineMax
  1664. end
  1665. if script.Parent:FindFirstChild("Magazine") == nil then
  1666. magazine = Instance.new("NumberValue")
  1667. magazine.Name = "Magazine"
  1668. magazine.Value = 3
  1669. magazine.Parent = script.Parent
  1670. else
  1671. magazine = script.Parent.Magazine
  1672. end
  1673. if script.Parent:FindFirstChild("AmmoMax") == nil then
  1674. ammoMax = Instance.new("NumberValue")
  1675. ammoMax.Name = "AmmoMax"
  1676. ammoMax.Value = 50 --You may set the ammo of the RPG here.
  1677. ammoMax.Parent = script.Parent
  1678. else
  1679. ammoMax = script.Parent.AmmoMax
  1680. end
  1681. if script.Parent:FindFirstChild("Ammo") == nil then
  1682. ammo = Instance.new("NumberValue")
  1683. ammo.Name = "Ammo"
  1684. ammo.Value = script.Parent.AmmoMax.Value
  1685. ammo.Parent = script.Parent
  1686. else
  1687. ammo = script.Parent.Ammo
  1688. end
  1689. Player = script.Parent.Parent.Parent
  1690. makeParts("RightHolster")
  1691. script.Parent.Selected:connect(onSelected)
  1692. script.Parent.Deselected:connect(onDeselected)
  1693. end
  1694. --lego
  1695. game.Workspace.Gaminhyena.Humanoid.MaxHealth = math.huge -----Replace my name with yours for INF HP
  1696. print(lego)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement