-----------------

m249

Sep 15th, 2020 (edited)
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 68.12 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86.  
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player is not moving their mouse, client won't fire events
  90. local HB = game:GetService("RunService").Heartbeat
  91. while true do
  92. if h~=Mouse.Hit or t~=Mouse.Target then
  93. h,t=Mouse.Hit,Mouse.Target
  94. Event:FireServer({isMouse=true,Target=t,Hit=h})
  95. end
  96. --Wait 2 frames
  97. for i=1,2 do
  98. HB:Wait()
  99. end
  100. end]==],script)
  101.  
  102. ----Sandboxed game object that allows the usage of client-side methods and services
  103. --Real game object
  104. local RealGame = game
  105.  
  106. --Metatable for fake service
  107. local FakeService_Metatable = {
  108. __index = function(self,k)
  109. local s = rawget(self,"_RealService")
  110. if s then
  111. return typeof(s[k])=="function"
  112. and function(_,...)return s[k](s,...)end or s[k]
  113. end
  114. end,
  115. __newindex = function(self,k,v)
  116. local s = rawget(self,"_RealService")
  117. if s then s[k]=v end
  118. end
  119. }
  120. local function FakeService(t,RealService)
  121. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122. return setmetatable(t,FakeService_Metatable)
  123. end
  124.  
  125. --Fake game object
  126. local FakeGame = {
  127. GetService = function(self,s)
  128. return rawget(self,s) or RealGame:GetService(s)
  129. end,
  130. Players = FakeService({
  131. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  132. },"Players"),
  133. UserInputService = FakeService(UIS,"UserInputService"),
  134. ContextActionService = FakeService(CAS,"ContextActionService"),
  135. RunService = FakeService({
  136. _btrs = {},
  137. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138. BindToRenderStep = function(self,name,_,fun)
  139. self._btrs[name] = self.Heartbeat:Connect(fun)
  140. end,
  141. UnbindFromRenderStep = function(self,name)
  142. self._btrs[name]:Disconnect()
  143. end,
  144. },"RunService")
  145. }
  146. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152. --[[
  153. Script shared by eletronix ]]
  154.  
  155. if script == nil then return end
  156.  
  157.  
  158. Player = script:FindFirstChild("Player") ~= nil and script.Player.Value or game.Players.LocalPlayer
  159. Name = "M249"
  160. MC = BrickColor.new("Black")
  161. DC = BrickColor.new("Black")
  162. GC = BrickColor.new("Dark stone grey")
  163. MR = 0
  164. GR = 0
  165. Holstered = true
  166. Spread = 90000
  167. WSPenalty = 10
  168. selected = false
  169. canDual = false
  170. dual = false
  171. Button1Down = false
  172. damage = 18
  173. canFire = true
  174. canFire2 = false
  175. readyTime = 0.1
  176. automatic = true
  177. burst = false
  178. burstCount = 0
  179. burstCountMax = 3
  180. canSilence = true
  181. silenced = false
  182. canZoom = false
  183. zoom = false
  184. switchToSingle = true
  185. switchToBurst = false
  186. switchToAutomatic = true
  187.  
  188.  
  189. ammoGui = Instance.new("ScreenGui")
  190. ammoGui.Name = Name
  191. local frame = Instance.new("Frame")
  192. frame.Name = "Frame"
  193. frame.Size = UDim2.new(0, 165, 0, 60)
  194. frame.Position = UDim2.new(0, 0, 1, -400)
  195. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  196. frame.BorderColor3 = Color3.new(0, 0, 0)
  197. frame.Parent = ammoGui
  198. local label = Instance.new("TextLabel")
  199. label.Name = "Weapon"
  200. label.Text = "Weapon: " ..Name
  201. label.Size = UDim2.new(1, 0, 0, 20)
  202. label.Position = UDim2.new(0, 0, 0, 0)
  203. label.BackgroundColor3 = Color3.new(1, 0, 0)
  204. label.BorderColor3 = Color3.new(0, 0, 0)
  205. label.Parent = frame
  206. local label = Instance.new("TextLabel")
  207. label.Name = "MagazinePrefix"
  208. label.Text = " Magazine:"
  209. label.TextXAlignment = "Left"
  210. label.Size = UDim2.new(1, 0, 0, 20)
  211. label.Position = UDim2.new(0, 0, 0, 20)
  212. label.BackgroundColor3 = Color3.new(1, 1, 1)
  213. label.BorderColor3 = Color3.new(0, 0, 0)
  214. label.Parent = frame
  215. local label = Instance.new("TextLabel")
  216. label.Name = "Magazine"
  217. label.Text = "0/0"
  218. label.TextXAlignment = "Right"
  219. label.Size = UDim2.new(1, 0, 0, 20)
  220. label.Position = UDim2.new(0, -10, 0, 20)
  221. label.BackgroundTransparency = 1
  222. label.BorderSizePixel = 0
  223. label.Parent = frame
  224. local label = Instance.new("TextLabel")
  225. label.Name = "AmmoPrefix"
  226. label.Text = " 5.56x45mm NATO:"
  227. label.TextXAlignment = "Left"
  228. label.Size = UDim2.new(1, 0, 0, 20)
  229. label.Position = UDim2.new(0, 0, 0, 40)
  230. label.BackgroundColor3 = Color3.new(1, 1, 1)
  231. label.BorderColor3 = Color3.new(0, 0, 0)
  232. label.Parent = frame
  233. local label = Instance.new("TextLabel")
  234. label.Name = "Ammo"
  235. label.Text = "0/0"
  236. label.TextXAlignment = "Right"
  237. label.Size = UDim2.new(1, 0, 0, 20)
  238. label.Position = UDim2.new(0, -10, 0, 40)
  239. label.BackgroundTransparency = 1
  240. label.BorderSizePixel = 0
  241. label.Parent = frame
  242.  
  243.  
  244. function updateGui()
  245. if selected == false then return end
  246. if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
  247. if Player.PlayerGui:FindFirstChild(Name) == nil then
  248. ammoGui:Clone().Parent = Player.PlayerGui
  249. end
  250. Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
  251. Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
  252. end
  253.  
  254.  
  255. function makeParts(format)
  256. local model = Instance.new("Model")
  257. model.Name = Name
  258. local pm = Instance.new("Part")
  259. pm.Name = "Handle"
  260. pm.formFactor = "Symmetric"
  261. pm.Size = Vector3.new(1, 1, 1)
  262. pm.BrickColor = MC
  263. pm.Reflectance = MR
  264. pm.CanCollide = false
  265. pm.Locked = true
  266. pm.TopSurface = 0
  267. pm.BottomSurface = 0
  268. pm.Parent = model
  269. local m = Instance.new("BlockMesh")
  270. m.Scale = Vector3.new(0.35, 1.4, 0.41)
  271. m.Offset = Vector3.new(0, 0.01, 0.07)
  272. m.Parent = pm
  273. if format ~= nil then
  274. local w = Instance.new("Weld")
  275. w.Part0 = pm
  276. if format == "RightHand" then
  277. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  278. w.C0 = CFrame.new(0, 1.15, 0.7)
  279. w.C1 = CFrame.new()
  280. elseif format == "RightHolster" then
  281. w.Part1 = Player.Character:FindFirstChild("Torso")
  282. w.C0 = CFrame.new(-0.65, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-40), math.rad(90), 0)
  283. w.C1 = CFrame.new()
  284. model.Name = Name.. " (Holstered)"
  285. end
  286. w.Parent = pm
  287. model.Parent = Player.Character
  288. end
  289. --[[
  290. sniper1 http://www.roblox.com/asset/?id=1868836
  291. equip http://www.roblox.com/asset/?id=13510737
  292. fire1 http://www.roblox.com/asset/?id=2760979
  293. fire2 http://www.roblox.com/asset/?id=13510352
  294. fire3 http://www.roblox.com/asset/?id=2692806
  295. fire4 http://www.roblox.com/asset/?id=2691586
  296. fire5 http://www.roblox.com/asset/?id=2920959
  297. fire6 http://www.roblox.com/asset/?id=2697431
  298. fire7 http://www.roblox.com/asset/?id=2920959
  299. reload1 http://www.roblox.com/asset/?id=2691591
  300. reload2 http://www.roblox.com/asset/?id=2697432
  301. reload3 http://www.roblox.com/asset/?id=2920960
  302. reload4 http://www.roblox.com/asset/?id=2761842
  303. shotgun1 http://www.roblox.com/asset/?id=2697294
  304. --]]
  305. local s = Instance.new("Sound")
  306. s.Name = "Fire"
  307. s.SoundId = "http://www.roblox.com/Asset/?id=10209798"
  308. s.Volume = 1
  309. s.Pitch = 1.8
  310. s.Looped = false
  311. s.Parent = pm
  312. local s = Instance.new("Sound")
  313. s.Name = "Fire2"
  314. s.SoundId = "http://www.roblox.com/Asset/?id=16211041"
  315. s.Volume = 1
  316. s.Pitch = 3
  317. s.Looped = false
  318. s.Parent = pm
  319. local s = Instance.new("Sound")
  320. s.Name = "Lock"
  321. s.SoundId = "http://www.roblox.com/Asset/?id=10209845"
  322. s.Volume = 1
  323. s.Pitch = 3
  324. s.Looped = false
  325. s.Parent = pm
  326. local s = Instance.new("Sound")
  327. s.Name = "Release"
  328. s.SoundId = "http://www.roblox.com/Asset/?id=10209813"
  329. s.Volume = 1
  330. s.Pitch = 4
  331. s.Looped = false
  332. s.Parent = pm
  333. local s = Instance.new("Sound")
  334. s.Name = "Reload"
  335. s.SoundId = "http://www.roblox.com/asset/?id=2761842"
  336. s.Volume = 1
  337. s.Pitch = 1.1
  338. s.Looped = false
  339. s.Parent = pm
  340. local s = Instance.new("Sound")
  341. s.Name = "Empty"
  342. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  343. s.Volume = 1
  344. s.Pitch = 5
  345. s.Looped = false
  346. s.Parent = pm
  347. local s = Instance.new("Sound")
  348. s.Name = "Switch"
  349. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  350. s.Volume = 1
  351. s.Pitch = 10
  352. s.Looped = false
  353. s.Parent = pm
  354. local s = Instance.new("Sound")
  355. s.Name = "Equip"
  356. s.SoundId = "http://www.roblox.com/Asset/?id=10209845"
  357. s.Volume = 1
  358. s.Pitch = 1.2
  359. s.Looped = false
  360. s.Parent = pm
  361. local p = Instance.new("Part")
  362. p.Name = "ShellOut"
  363. p.formFactor = "Symmetric"
  364. p.Size = Vector3.new(1, 1, 1)
  365. p.Transparency = 1
  366. p.Locked = true
  367. p.CanCollide = false
  368. p.TopSurface = 0
  369. p.BottomSurface = 0
  370. p.Parent = model
  371. local w = Instance.new("Weld")
  372. w.Part0 = p
  373. w.Part1 = pm
  374. w.C0 = CFrame.new(0, 0.46, 1) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  375. w.C1 = CFrame.new()
  376. w.Parent = p
  377. local p = Instance.new("Part")
  378. p.Name = "Grip"
  379. p.formFactor = "Symmetric"
  380. p.Size = Vector3.new(1, 1, 1)
  381. p.BrickColor = MC
  382. p.Reflectance = MR
  383. p.CanCollide = false
  384. p.Locked = true
  385. p.TopSurface = 0
  386. p.BottomSurface = 0
  387. p.Parent = model
  388. local m = Instance.new("BlockMesh")
  389. m.Scale = Vector3.new(0.29, 0.38, 0.8)
  390. m.Parent = p
  391. local w = Instance.new("Weld")
  392. w.Part0 = p
  393. w.Part1 = pm
  394. w.C0 = CFrame.new(0, -0.15, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
  395. w.C1 = CFrame.new()
  396. w.Parent = p
  397. local p = Instance.new("Part")
  398. p.Name = "Body"
  399. p.formFactor = "Symmetric"
  400. p.Size = Vector3.new(1, 1, 1)
  401. p.BrickColor = MC
  402. p.Reflectance = MR
  403. p.CanCollide = false
  404. p.Locked = true
  405. p.TopSurface = 0
  406. p.BottomSurface = 0
  407. p.Parent = model
  408. local m = Instance.new("BlockMesh")
  409. m.Scale = Vector3.new(0.35, 0.3, 0.44)
  410. m.Parent = p
  411. local w = Instance.new("Weld")
  412. w.Part0 = p
  413. w.Part1 = pm
  414. w.C0 = CFrame.new(0, -0.56, -0.06)
  415. w.C1 = CFrame.new()
  416. w.Parent = p
  417. local p = Instance.new("Part")
  418. p.Name = "Rearsight"
  419. p.formFactor = "Symmetric"
  420. p.Size = Vector3.new(1, 1, 1)
  421. p.BrickColor = MC
  422. p.Reflectance = MR
  423. p.CanCollide = false
  424. p.Locked = true
  425. p.TopSurface = 0
  426. p.BottomSurface = 0
  427. p.Parent = model
  428. local m = Instance.new("BlockMesh")
  429. m.Scale = Vector3.new(0.08, 0.2, 0.44)
  430. m.Offset = Vector3.new(0.12, 0, 0)
  431. m.Parent = p
  432. local w = Instance.new("Weld")
  433. w.Part0 = p
  434. w.Part1 = pm
  435. w.C0 = CFrame.new(0, -0.56, 0)
  436. w.C1 = CFrame.new()
  437. w.Parent = p
  438. local p = Instance.new("Part")
  439. p.Name = "Rearsight"
  440. p.formFactor = "Symmetric"
  441. p.Size = Vector3.new(1, 1, 1)
  442. p.BrickColor = MC
  443. p.Reflectance = MR
  444. p.CanCollide = false
  445. p.Locked = true
  446. p.TopSurface = 0
  447. p.BottomSurface = 0
  448. p.Parent = model
  449. local m = Instance.new("BlockMesh")
  450. m.Scale = Vector3.new(0.08, 0.2, 0.44)
  451. m.Offset = Vector3.new(-0.12, 0, 0)
  452. m.Parent = p
  453. local w = Instance.new("Weld")
  454. w.Part0 = p
  455. w.Part1 = pm
  456. w.C0 = CFrame.new(0, -0.56, 0)
  457. w.C1 = CFrame.new()
  458. w.Parent = p
  459. local p = Instance.new("Part")
  460. p.Name = "Frontsight"
  461. p.formFactor = "Symmetric"
  462. p.Size = Vector3.new(1, 1, 1)
  463. p.BrickColor = MC
  464. p.Reflectance = MR
  465. p.CanCollide = false
  466. p.Locked = true
  467. p.TopSurface = 0
  468. p.BottomSurface = 0
  469. p.Parent = model
  470. local m = Instance.new("BlockMesh")
  471. m.Scale = Vector3.new(0.08, 0.1, 0.3)
  472. m.Parent = p
  473. local w = Instance.new("Weld")
  474. w.Part0 = p
  475. w.Part1 = pm
  476. w.C0 = CFrame.new(0, 2, 0.07)
  477. w.C1 = CFrame.new()
  478. w.Parent = p
  479. local p = Instance.new("Part")
  480. p.Name = "Top2C"
  481. p.formFactor = "Symmetric"
  482. p.Size = Vector3.new(1, 1, 1)
  483. p.BrickColor = MC
  484. p.Reflectance = MR
  485. p.CanCollide = false
  486. p.Locked = true
  487. p.TopSurface = 0
  488. p.BottomSurface = 0
  489. p.Parent = model
  490. local m = Instance.new("BlockMesh")
  491. m.Scale = Vector3.new(0.42, 0.46, 0.12)
  492. m.Parent = p
  493. local w = Instance.new("Weld")
  494. w.Part0 = p
  495. w.Part1 = pm
  496. w.C0 = CFrame.new(0.035, 0.46, 0.1)
  497. w.C1 = CFrame.new()
  498. w.Parent = p
  499. local p = Instance.new("Part")
  500. p.Name = "Top2O"
  501. p.formFactor = "Symmetric"
  502. p.Size = Vector3.new(1, 1, 1)
  503. p.BrickColor = MC
  504. p.Reflectance = MR
  505. p.CanCollide = false
  506. p.Transparency = 1
  507. p.Locked = true
  508. p.TopSurface = 0
  509. p.BottomSurface = 0
  510. p.Parent = model
  511. local m = Instance.new("BlockMesh")
  512. m.Scale = Vector3.new(0.42, 0.46, 0.12)
  513. m.Parent = p
  514. local w = Instance.new("Weld")
  515. w.Part0 = p
  516. w.Part1 = pm
  517. w.C0 = CFrame.new(0.035, 0.4, 0.38) * CFrame.fromEulerAnglesXYZ(math.rad(20), 0, 0)
  518. w.C1 = CFrame.new()
  519. w.Parent = p
  520. local p = Instance.new("Part")
  521. p.Name = "TopC"
  522. p.formFactor = "Symmetric"
  523. p.Size = Vector3.new(1, 1, 1)
  524. p.BrickColor = MC
  525. p.Reflectance = MR
  526. p.CanCollide = false
  527. p.Locked = true
  528. p.TopSurface = 0
  529. p.BottomSurface = 0
  530. p.Parent = model
  531. local m = Instance.new("BlockMesh")
  532. m.Scale = Vector3.new(0.35, 1.1, 0.12)
  533. m.Parent = p
  534. local w = Instance.new("Weld")
  535. w.Part0 = p
  536. w.Part1 = pm
  537. w.C0 = CFrame.new(0, 0.14, 0.1)
  538. w.C1 = CFrame.new()
  539. w.Parent = p
  540. local p = Instance.new("Part")
  541. p.Name = "TopO"
  542. p.formFactor = "Symmetric"
  543. p.Size = Vector3.new(1, 1, 1)
  544. p.BrickColor = MC
  545. p.Reflectance = MR
  546. p.CanCollide = false
  547. p.Transparency = 1
  548. p.Locked = true
  549. p.TopSurface = 0
  550. p.BottomSurface = 0
  551. p.Parent = model
  552. local m = Instance.new("BlockMesh")
  553. m.Scale = Vector3.new(0.35, 1.1, 0.12)
  554. m.Parent = p
  555. local w = Instance.new("Weld")
  556. w.Part0 = p
  557. w.Part1 = pm
  558. w.C0 = CFrame.new(0, 0.05, 0.38) * CFrame.fromEulerAnglesXYZ(math.rad(20), 0, 0)
  559. w.C1 = CFrame.new()
  560. w.Parent = p
  561. local p = Instance.new("Part")
  562. p.Name = "Magazine"
  563. p.formFactor = "Symmetric"
  564. p.Size = Vector3.new(1, 1, 1)
  565. p.BrickColor = BrickColor.new("Sand green")
  566. p.Locked = true
  567. p.CanCollide = false
  568. p.TopSurface = 0
  569. p.BottomSurface = 0
  570. p.Parent = model
  571. local m = Instance.new("BlockMesh")
  572. m.Scale = Vector3.new(0.8, 0.43, 0.6)
  573. m.Parent = p
  574. local w = Instance.new("Weld")
  575. w.Part0 = p
  576. w.Part1 = pm
  577. w.C0 = CFrame.new(0, 0.46, -0.5)
  578. w.C1 = CFrame.new()
  579. w.Parent = p
  580. local p = Instance.new("Part")
  581. p.Name = "Magazine2"
  582. p.formFactor = "Symmetric"
  583. p.Size = Vector3.new(1, 1, 1)
  584. p.BrickColor = BrickColor.new("Bright yellow")
  585. p.Locked = true
  586. p.CanCollide = false
  587. p.Reflectance = 0.3
  588. if magazine.Value ~= 0 then
  589. p.Transparency = 0
  590. else
  591. p.Transparency = 1
  592. end
  593. p.TopSurface = 0
  594. p.BottomSurface = 0
  595. p.Parent = model
  596. local m = Instance.new("BlockMesh")
  597. m.Scale = Vector3.new(0.06, 0.36, 0.6)
  598. m.Parent = p
  599. local w = Instance.new("Weld")
  600. w.Part0 = p
  601. w.Part1 = pm
  602. w.C0 = CFrame.new(0.18, 0.46, -0.26) * CFrame.fromEulerAnglesXYZ(0, math.rad(20), 0)
  603. w.C1 = CFrame.new()
  604. w.Parent = p
  605. local p = Instance.new("Part")
  606. p.Name = "TriggerGuard"
  607. p.formFactor = "Symmetric"
  608. p.Size = Vector3.new(1, 1, 1)
  609. p.BrickColor = MC
  610. p.Reflectance = MR
  611. p.CanCollide = false
  612. p.Locked = true
  613. p.TopSurface = 0
  614. p.BottomSurface = 0
  615. p.Parent = model
  616. local m = Instance.new("SpecialMesh")
  617. m.MeshType = "FileMesh"
  618. m.MeshId = "http://www.roblox.com/asset/?id=3270017"
  619. m.Scale = Vector3.new(0.3, 0.3, 0.8)
  620. m.Parent = p
  621. local w = Instance.new("Weld")
  622. w.Part0 = p
  623. w.Part1 = pm
  624. w.C0 = CFrame.new(-0.25, 0, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  625. w.C1 = CFrame.new()
  626. w.Parent = p
  627. local p = Instance.new("Part")
  628. p.Name = "Trigger"
  629. p.formFactor = "Symmetric"
  630. p.Size = Vector3.new(1, 1, 1)
  631. p.BrickColor = BrickColor.new("Dark stone grey")
  632. p.Reflectance = MR
  633. p.CanCollide = false
  634. p.Locked = true
  635. p.TopSurface = 0
  636. p.BottomSurface = 0
  637. p.Parent = model
  638. local m = Instance.new("BlockMesh")
  639. m.Scale = Vector3.new(0.1, 0.4, 0.16)
  640. m.Parent = p
  641. local w = Instance.new("Weld")
  642. w.Part0 = p
  643. w.Part1 = pm
  644. w.C0 = CFrame.new(0, -0.14, -0.3)
  645. w.C1 = CFrame.new()
  646. w.Parent = p
  647. local p = Instance.new("Part")
  648. p.Name = "ForeBarrel"
  649. p.CanCollide = false
  650. p.formFactor = "Symmetric"
  651. p.Size = Vector3.new(1, 1, 1)
  652. p.BrickColor = GC
  653. p.Reflectance = GR
  654. p.Locked = true
  655. p.TopSurface = 0
  656. p.BottomSurface = 0
  657. p.Parent = model
  658. local m = Instance.new("BlockMesh")
  659. m.Scale = Vector3.new(0.25, 1, 0.25)
  660. m.Parent = p
  661. local w = Instance.new("Weld")
  662. w.Part0 = p
  663. w.Part1 = pm
  664. w.C0 = CFrame.new(0, 1.18, -0.1)
  665. w.C1 = CFrame.new()
  666. w.Parent = p
  667. local p = Instance.new("Part")
  668. p.Name = "ForeBarrel"
  669. p.CanCollide = false
  670. p.formFactor = "Symmetric"
  671. p.Size = Vector3.new(1, 1, 1)
  672. p.BrickColor = GC
  673. p.Reflectance = GR
  674. p.Locked = true
  675. p.TopSurface = 0
  676. p.BottomSurface = 0
  677. p.Parent = model
  678. local m = Instance.new("BlockMesh")
  679. m.Scale = Vector3.new(0.25, 0.8, 0.3)
  680. m.Parent = p
  681. local w = Instance.new("Weld")
  682. w.Part0 = p
  683. w.Part1 = pm
  684. w.C0 = CFrame.new(0, 1.09, -0.25)
  685. w.C1 = CFrame.new()
  686. w.Parent = p
  687. local p = Instance.new("Part")
  688. p.Name = "Shroud"
  689. p.CanCollide = false
  690. p.formFactor = "Symmetric"
  691. p.Size = Vector3.new(1, 1, 1)
  692. p.BrickColor = MC
  693. p.Reflectance = MR
  694. p.Locked = true
  695. p.TopSurface = 0
  696. p.BottomSurface = 0
  697. p.Parent = model
  698. local m = Instance.new("CylinderMesh")
  699. m.Scale = Vector3.new(0.26, 0.999, 0.26)
  700. m.Parent = p
  701. local w = Instance.new("Weld")
  702. w.Part0 = p
  703. w.Part1 = pm
  704. w.C0 = CFrame.new(0, 1.18, 0)
  705. w.C1 = CFrame.new()
  706. w.Parent = p
  707. local p = Instance.new("Part")
  708. p.Name = "Rail" --------------
  709. p.CanCollide = false
  710. p.formFactor = "Symmetric"
  711. p.Size = Vector3.new(1, 1, 1)
  712. p.BrickColor = MC
  713. p.Reflectance = MR
  714. p.Locked = true
  715. p.TopSurface = 0
  716. p.BottomSurface = 0
  717. p.Parent = model
  718. local m = Instance.new("BlockMesh")
  719. m.Scale = Vector3.new(0.18, 1, 0.18)
  720. m.Parent = p
  721. local w = Instance.new("Weld")
  722. w.Part0 = p
  723. w.Part1 = pm
  724. w.C0 = CFrame.new(0, 1.17, -0.04)
  725. w.C1 = CFrame.new()
  726. w.Parent = p
  727. local p = Instance.new("Part")
  728. p.Name = "Barrel 1"
  729. p.formFactor = "Symmetric"
  730. p.Size = Vector3.new(1, 1, 1)
  731. p.BrickColor = DC
  732. p.Reflectance = MR
  733. p.CanCollide = false
  734. p.Locked = true
  735. p.TopSurface = 0
  736. p.BottomSurface = 0
  737. p.Parent = model
  738. local m = Instance.new("CylinderMesh")
  739. m.Scale = Vector3.new(0.15, 0.8, 0.15)
  740. m.Parent = p
  741. local w = Instance.new("Weld")
  742. w.Part0 = p
  743. w.Part1 = pm
  744. w.C0 = CFrame.new(0, 1.6, -0.04)
  745. w.C1 = CFrame.new()
  746. w.Parent = p
  747. local p = Instance.new("Part")
  748. p.Name = "Hole"
  749. p.formFactor = "Symmetric"
  750. p.Size = Vector3.new(1, 1, 1)
  751. p.BrickColor = BrickColor.new("Really black")
  752. p.CanCollide = false
  753. p.Locked = true
  754. p.TopSurface = 0
  755. p.BottomSurface = 0
  756. p.Parent = model
  757. local m = Instance.new("CylinderMesh")
  758. m.Scale = Vector3.new(0.14, 0.4, 0.14)
  759. m.Offset = Vector3.new(0, 0.2, 0)
  760. m.Parent = p
  761. local w = Instance.new("Weld")
  762. w.Part0 = p
  763. w.Part1 = pm
  764. w.C0 = CFrame.new(0, 2.405, -0.04)
  765. w.C1 = CFrame.new()
  766. w.Parent = p
  767. local p = Instance.new("Part")
  768. if silenced == false then
  769. p.Name = "Muzzle"
  770. else
  771. p.Name = "Muzzle 2"
  772. end
  773. p.formFactor = "Symmetric"
  774. p.Size = Vector3.new(1, 1, 1)
  775. p.BrickColor = DC
  776. p.Reflectance = MR
  777. p.CanCollide = false
  778. p.Locked = true
  779. p.TopSurface = 0
  780. p.BottomSurface = 0
  781. p.Parent = model
  782. local m = Instance.new("CylinderMesh")
  783. m.Scale = Vector3.new(0.18, 0.4, 0.18)
  784. m.Offset = Vector3.new(0, 0.2, 0)
  785. m.Parent = p
  786. local w = Instance.new("Weld")
  787. w.Part0 = p
  788. w.Part1 = pm
  789. w.C0 = CFrame.new(0, 2.4, -0.04)
  790. w.C1 = CFrame.new()
  791. w.Parent = p
  792. local s = Instance.new("Smoke")
  793. s.Enabled = false
  794. s.Name = "Smoke"
  795. s.RiseVelocity = -5
  796. s.Opacity = 0.3
  797. s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225)
  798. s.Size = 1
  799. s.Parent = p
  800. local f = Instance.new("Fire")
  801. f.Enabled = false
  802. f.Name = "Fire"
  803. f.Heat = -35
  804. f.Size = 1
  805. f.Parent = p
  806. local p = Instance.new("Part")
  807. p.Name = "Silencer"
  808. p.formFactor = "Symmetric"
  809. p.Size = Vector3.new(1, 1, 1)
  810. p.BrickColor = BrickColor.new("Black")
  811. p.CanCollide = false
  812. if silenced == false then
  813. p.Name = "Silencer"
  814. p.Transparency = 1
  815. else
  816. p.Name = "Muzzle"
  817. p.Transparency = 0
  818. end
  819. p.Locked = true
  820. p.TopSurface = 0
  821. p.BottomSurface = 0
  822. p.Parent = model
  823. local m = Instance.new("CylinderMesh")
  824. m.Scale = Vector3.new(0.25, 0.8, 0.25)
  825. m.Parent = p
  826. local w = Instance.new("Weld")
  827. w.Part0 = p
  828. w.Part1 = pm
  829. w.C0 = CFrame.new(0, 2.5, -0.04)
  830. w.C1 = CFrame.new()
  831. w.Parent = p
  832. if Holstered == true then
  833. local p = Instance.new("Part")
  834. p.Name = "StockI"
  835. p.CanCollide = false
  836. p.formFactor = "Symmetric"
  837. p.Size = Vector3.new(1, 1, 1)
  838. p.BrickColor = MC
  839. p.Reflectance = MR
  840. p.Locked = true
  841. p.TopSurface = 0
  842. p.BottomSurface = 0
  843. p.Parent = model
  844. local m = Instance.new("CylinderMesh")
  845. m.Scale = Vector3.new(0.36, 0.2, 0.36)
  846. m.Parent = p
  847. local w = Instance.new("Weld")
  848. w.Part0 = p
  849. w.Part1 = pm
  850. w.C0 = CFrame.new(0, -0.7, -0.1)
  851. w.C1 = CFrame.new()
  852. w.Parent = p
  853. else
  854. local p = Instance.new("Part")
  855. p.Name = "StockO"
  856. p.CanCollide = false
  857. p.formFactor = "Symmetric"
  858. p.Size = Vector3.new(1, 1, 1)
  859. p.BrickColor = MC
  860. p.Reflectance = MR
  861. p.Locked = true
  862. p.TopSurface = 0
  863. p.BottomSurface = 0
  864. p.Parent = model
  865. local m = Instance.new("CylinderMesh")
  866. m.Scale = Vector3.new(0.36, 0.2, 0.36)
  867. m.Parent = p
  868. local w = Instance.new("Weld")
  869. w.Part0 = p
  870. w.Part1 = pm
  871. w.C0 = CFrame.new(0, -1.4, -0.1)
  872. w.C1 = CFrame.new()
  873. w.Parent = p
  874. local p = Instance.new("Part")
  875. p.Name = "StockArm"
  876. p.CanCollide = false
  877. p.formFactor = "Symmetric"
  878. p.Size = Vector3.new(1, 1, 1)
  879. p.BrickColor = MC
  880. p.Reflectance = MR
  881. p.Locked = true
  882. p.TopSurface = 0
  883. p.BottomSurface = 0
  884. p.Parent = model
  885. local m = Instance.new("BlockMesh")
  886. m.Scale = Vector3.new(0.1, 0.8, 0.1)
  887. m.Offset = Vector3.new(0, 0, 0.12)
  888. m.Parent = p
  889. local w = Instance.new("Weld")
  890. w.Part0 = p
  891. w.Part1 = pm
  892. w.C0 = CFrame.new(0, -0.9, -0.1)
  893. w.C1 = CFrame.new()
  894. w.Parent = p
  895. local p = Instance.new("Part")
  896. p.Name = "StockArm"
  897. p.CanCollide = false
  898. p.formFactor = "Symmetric"
  899. p.Size = Vector3.new(1, 1, 1)
  900. p.BrickColor = MC
  901. p.Reflectance = MR
  902. p.Locked = true
  903. p.TopSurface = 0
  904. p.BottomSurface = 0
  905. p.Parent = model
  906. local m = Instance.new("BlockMesh")
  907. m.Scale = Vector3.new(0.1, 0.8, 0.1)
  908. m.Offset = Vector3.new(0, 0, -0.12)
  909. m.Parent = p
  910. local w = Instance.new("Weld")
  911. w.Part0 = p
  912. w.Part1 = pm
  913. w.C0 = CFrame.new(0, -0.9, -0.1)
  914. w.C1 = CFrame.new()
  915. w.Parent = p
  916. end
  917. return model
  918. end
  919.  
  920.  
  921. function removeParts(format)
  922. if format == "RightHand" then
  923. pcall(function() Player.Character[Name]:Remove() end)
  924. elseif format == "LeftHand" then
  925. pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
  926. elseif format == "RightHolster" then
  927. pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
  928. elseif format == "LeftHolster" then
  929. pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
  930. end
  931. end
  932.  
  933.  
  934. function SetAngle(Joint, Angle, Character)
  935. if Character == nil then return false end
  936. local Joints = {
  937. Character.Torso:FindFirstChild("Right Shoulder 2"),
  938. Character.Torso:FindFirstChild("Left Shoulder 2"),
  939. Character.Torso:FindFirstChild("Right Hip 2"),
  940. Character.Torso:FindFirstChild("Left Hip 2")
  941. }
  942. if Joints[Joint] == nil then return false end
  943. if Joint == 1 or Joint == 3 then
  944. Joints[Joint].DesiredAngle = Angle
  945. end
  946. if Joint == 2 or Joint == 4 then
  947. Joints[Joint].DesiredAngle = -Angle
  948. end
  949. end
  950.  
  951.  
  952. function ForceAngle(Joint, Angle, Character)
  953. if Character == nil then return false end
  954. local Joints = {
  955. Character.Torso:FindFirstChild("Right Shoulder 2"),
  956. Character.Torso:FindFirstChild("Left Shoulder 2"),
  957. Character.Torso:FindFirstChild("Right Hip 2"),
  958. Character.Torso:FindFirstChild("Left Hip 2")
  959. }
  960. if Joints[Joint] == nil then return false end
  961. if Joint == 1 or Joint == 3 then
  962. Joints[Joint].DesiredAngle = Angle
  963. Joints[Joint].CurrentAngle = Angle
  964. end
  965. if Joint == 2 or Joint == 4 then
  966. Joints[Joint].DesiredAngle = -Angle
  967. Joints[Joint].CurrentAngle = -Angle
  968. end
  969. end
  970.  
  971.  
  972. function SetSpeed(Joint, Speed, Character)
  973. if Character == nil then return false end
  974. local Joints = {
  975. Character.Torso:FindFirstChild("Right Shoulder 2"),
  976. Character.Torso:FindFirstChild("Left Shoulder 2"),
  977. Character.Torso:FindFirstChild("Right Hip 2"),
  978. Character.Torso:FindFirstChild("Left Hip 2")
  979. }
  980. if Joints[Joint] == nil then return false end
  981. Joints[Joint].MaxVelocity = Speed
  982. end
  983.  
  984.  
  985. function DisableLimb(Limb, Character)
  986. if Character == nil then return false end
  987. if Character:FindFirstChild("Torso") == nil then return false end
  988. local Joints = {
  989. Character.Torso:FindFirstChild("Right Shoulder"),
  990. Character.Torso:FindFirstChild("Left Shoulder"),
  991. Character.Torso:FindFirstChild("Right Hip"),
  992. Character.Torso:FindFirstChild("Left Hip")
  993. }
  994. local Limbs = {
  995. Character:FindFirstChild("Right Arm"),
  996. Character:FindFirstChild("Left Arm"),
  997. Character:FindFirstChild("Right Leg"),
  998. Character:FindFirstChild("Left Leg")
  999. }
  1000. if Joints[Limb] == nil then return false end
  1001. if Limbs[Limb] == nil then return false end
  1002. local Joint = Instance.new("Motor")
  1003. Joint.Parent = Character.Torso
  1004. Joint.Part0 = Character.Torso
  1005. Joint.Part1 = Limbs[Limb]
  1006. if Limb == 1 then
  1007. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1008. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1009. Joint.Name = "Right Shoulder 2"
  1010. elseif Limb == 2 then
  1011. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1012. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1013. Joint.Name = "Left Shoulder 2"
  1014. elseif Limb == 3 then
  1015. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1016. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1017. Joint.Name = "Right Hip 2"
  1018. elseif Limb == 4 then
  1019. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1020. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1021. Joint.Name = "Left Hip 2"
  1022. end
  1023. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  1024. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  1025. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  1026. Joints[Limb]:Remove()
  1027. end
  1028.  
  1029.  
  1030. function ResetLimbCFrame(Limb, Character)
  1031. if Character == nil then return false end
  1032. if Character.Parent == nil then return false end
  1033. if Character:FindFirstChild("Torso") == nil then return false end
  1034. local Joints = {
  1035. Character.Torso:FindFirstChild("Right Shoulder 2"),
  1036. Character.Torso:FindFirstChild("Left Shoulder 2"),
  1037. Character.Torso:FindFirstChild("Right Hip 2"),
  1038. Character.Torso:FindFirstChild("Left Hip 2")
  1039. }
  1040. local Limbs = {
  1041. Character:FindFirstChild("Right Arm"),
  1042. Character:FindFirstChild("Left Arm"),
  1043. Character:FindFirstChild("Right Leg"),
  1044. Character:FindFirstChild("Left Leg")
  1045. }
  1046. if Joints[Limb] == nil then return false end
  1047. if Limbs[Limb] == nil then return false end
  1048. if Limb == 1 then
  1049. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1050. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1051. elseif Limb == 2 then
  1052. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1053. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1054. elseif Limb == 3 then
  1055. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1056. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1057. elseif Limb == 4 then
  1058. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1059. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1060. end
  1061. end
  1062.  
  1063.  
  1064. function EnableLimb(Limb, Character)
  1065. if Character == nil then return false end
  1066. if Character:FindFirstChild("Torso") == nil then return false end
  1067. local Joints = {
  1068. Character.Torso:FindFirstChild("Right Shoulder 2"),
  1069. Character.Torso:FindFirstChild("Left Shoulder 2"),
  1070. Character.Torso:FindFirstChild("Right Hip 2"),
  1071. Character.Torso:FindFirstChild("Left Hip 2")
  1072. }
  1073. local Limbs = {
  1074. Character:FindFirstChild("Right Arm"),
  1075. Character:FindFirstChild("Left Arm"),
  1076. Character:FindFirstChild("Right Leg"),
  1077. Character:FindFirstChild("Left Leg")
  1078. }
  1079. if Joints[Limb] == nil then return false end
  1080. if Limbs[Limb] == nil then return false end
  1081. if Limb == 1 then
  1082. Joints[Limb].Name = "Right Shoulder"
  1083. elseif Limb == 2 then
  1084. Joints[Limb].Name = "Left Shoulder"
  1085. elseif Limb == 3 then
  1086. Joints[Limb].Name = "Right Hip"
  1087. elseif Limb == 4 then
  1088. Joints[Limb].Name = "Left Hip"
  1089. end
  1090. Animate = Character:FindFirstChild("Animate")
  1091. if Animate == nil then return false end
  1092. Animate = Animate:Clone()
  1093. Character.Animate:Remove()
  1094. Animate.Parent = Character
  1095. end
  1096.  
  1097.  
  1098. function playAnimation(format, mouse)
  1099. if format == "equip" then
  1100. Player.Character.Humanoid.WalkSpeed = WSPenalty
  1101. coroutine.resume(coroutine.create(function()
  1102. for i = 0, 1, 0.025 do
  1103. if Player.Character:FindFirstChild("Torso") ~= nil then
  1104. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1105. 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)
  1106. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0)
  1107. else return false end
  1108. else return false end
  1109. wait()
  1110. end
  1111. end))
  1112. for i = 0, 1, 0.05 do
  1113. if Player.Character:FindFirstChild("Torso") ~= nil then
  1114. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1115. 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)
  1116. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0)
  1117. else return false end
  1118. else return false end
  1119. wait()
  1120. end
  1121. removeParts("RightHolster")
  1122. makeParts("RightHand")
  1123. for i = 0, 1, 0.05 do
  1124. if Player.Character:FindFirstChild("Torso") ~= nil then
  1125. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1126. 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)
  1127. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 0.75 * i, 0.1 * i)
  1128. else return false end
  1129. else return false end
  1130. if Player.Character:FindFirstChild(Name) ~= nil then
  1131. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  1132. Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 1.5, 0.75)
  1133. Player.Character[Name].Handle.Weld.C1 = CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, 0)
  1134. else return false end
  1135. else return false end
  1136. wait()
  1137. end
  1138. makeParts("RightHolster")
  1139. removeParts("RightHand")
  1140. return playAnimation("hold")
  1141. end
  1142. if format == "unequip" then
  1143. Player.Character.Humanoid.WalkSpeed = 16
  1144. coroutine.resume(coroutine.create(function()
  1145. for i = 1, 0, -0.025 do
  1146. if Player.Character:FindFirstChild("Torso") ~= nil then
  1147. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1148. 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)
  1149. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0)
  1150. else return false end
  1151. else return false end
  1152. wait()
  1153. end
  1154. end))
  1155. for i = 1, 0, -0.05 do
  1156. if Player.Character:FindFirstChild("Torso") ~= nil then
  1157. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1158. 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)
  1159. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 0.75 * i, 0.1 * i)
  1160. else return false end
  1161. else return false end
  1162. if Player.Character:FindFirstChild(Name) ~= nil then
  1163. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  1164. Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 1.5, 0.75)
  1165. Player.Character[Name].Handle.Weld.C1 = CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, 0)
  1166. else return false end
  1167. else return false end
  1168. wait()
  1169. end
  1170. makeParts("RightHolster")
  1171. removeParts("RightHand")
  1172. for i = 1, 0, -0.05 do
  1173. if Player.Character:FindFirstChild("Torso") ~= nil then
  1174. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1175. 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)
  1176. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0)
  1177. else return false end
  1178. else return false end
  1179. wait()
  1180. end
  1181. removeParts("RightHolster")
  1182. makeParts("RightHand")
  1183. return true
  1184. end
  1185. if format == "hold" then
  1186. if Player.Character:FindFirstChild("Torso") ~= nil then
  1187. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1188. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1189. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.3, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
  1190. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1191. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1192. else return false end
  1193. else return false end
  1194. end
  1195. if format == "reload" then
  1196. Player.Character[Name].Handle.Weld:Remove()
  1197. local w = Instance.new("Weld")
  1198. w.Part0 = Player.Character[Name].Handle
  1199. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  1200. w.C0 = CFrame.new(-0.85, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-5), math.rad(90), 0)
  1201. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, 0)
  1202. w.Parent = Player.Character[Name].Handle
  1203. if Player.Character:FindFirstChild("Torso") ~= nil then
  1204. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1205. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1206. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
  1207. else return false end
  1208. else return false end
  1209. wait(0.3)
  1210. for i = 0, 1, 0.1 do
  1211. if Player.Character:FindFirstChild("Torso") ~= nil then
  1212. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1213. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1214. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9 + (i / 10), -0.35 + (i * 1.5), 0.51 + (i / 8)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1215. wait()
  1216. else return false end
  1217. else return false end
  1218. end
  1219. for i = 0, 1, 0.25 do
  1220. if Player.Character:FindFirstChild("Torso") ~= nil then
  1221. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1222. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1223. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.8, 1.15 - (i / 5), 0.635) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1224. wait()
  1225. else return false end
  1226. else return false end
  1227. end
  1228. Player.Character[Name].Handle.Equip:Play()
  1229. if magazine.Value ~= 0 then
  1230. makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
  1231. else end
  1232. for i = 1, 0, -0.25 do
  1233. if Player.Character:FindFirstChild("Torso") ~= nil then
  1234. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1235. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1236. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.8, 1.15 - (i / 5), 0.635) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1237. wait()
  1238. else return false end
  1239. else return false end
  1240. end
  1241. for i = 1, 0, -0.1 do
  1242. if Player.Character:FindFirstChild("Torso") ~= nil then
  1243. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1244. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1245. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9 + (i / 10), -0.35 + (i * 1.5), 0.51 + (i / 8)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1246. wait()
  1247. else return false end
  1248. else return false end
  1249. end
  1250. removeParts("RightHand")
  1251. makeParts("RightHand")
  1252. wait(0.4)
  1253. Player.Character[Name].Handle.Lock:Play()
  1254. for i = 5, 0, -1 do
  1255. if Player.Character:FindFirstChild("Torso") ~= nil then
  1256. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1257. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1258. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
  1259. wait()
  1260. else return false end
  1261. else return false end
  1262. end
  1263. Player.Character[Name].TopC.Transparency = 1
  1264. Player.Character[Name].TopO.Transparency = 0
  1265. Player.Character[Name].Top2C.Transparency = 1
  1266. Player.Character[Name].Top2O.Transparency = 0
  1267. wait(0.4)
  1268. Player.Character[Name].Handle.Reload:Play()
  1269. Player.Character[Name].Handle.Release:Play()
  1270. Player.Character[Name].Magazine.Transparency = 1
  1271. Player.Character[Name].Magazine2.Transparency = 1
  1272. magazineDrop = Player.Character[Name].Magazine:Clone()
  1273. magazineDrop.Transparency = 0
  1274. magazineDrop.CanCollide = true
  1275. magazineDrop.Parent = game.Workspace
  1276. coroutine.resume(coroutine.create(function(part) wait(4.5) for i = 0, 1, 0.1 do part.Transparency = i wait() end part:Remove() end), magazineDrop)
  1277. delay(0.1, function() magazineDrop.CanCollide = true end)
  1278. for i = 0, 25, 5 do
  1279. if Player.Character:FindFirstChild("Torso") ~= nil then
  1280. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1281. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1282. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 + (i / 60), 1.2 - (i / 20), 0.8 + (i / 35)) * CFrame.fromEulerAnglesXYZ(math.rad(300 - i), math.rad(10 + -i * 3.5), math.rad(-90))
  1283. wait()
  1284. else return false end
  1285. else return false end
  1286. end
  1287. magazineNew = Player.Character[Name].Magazine:Clone()
  1288. magazineNew.Name = "New Magazine"
  1289. magazineNew.Transparency = 0
  1290. magazineNew.Parent = Player.Character[Name]
  1291. local w = Instance.new("Weld")
  1292. w.Part0 = magazineNew
  1293. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  1294. w.C0 = CFrame.new(0, 1.1, 0)
  1295. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1296. w.Parent = magazineNew
  1297. wait(0.2)
  1298. for i = 25, 0, -5 do
  1299. if Player.Character:FindFirstChild("Torso") ~= nil then
  1300. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1301. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1302. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.3 + ((i + 10) / 60), 1.2 - ((i + 10) / 20), 0.8 + (i / 35)) * CFrame.fromEulerAnglesXYZ(math.rad(300 - (i - 10)), math.rad(10 + -i * 3.5), math.rad(-90))
  1303. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1304. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9 + ((25 - i) / 30), -0.35, 0.51 + ((25 - i) / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), math.rad((25 * 2) - (i * 2)))
  1305. wait()
  1306. else return false end
  1307. else return false end
  1308. end
  1309. Player.Character[Name].Magazine.Transparency = 0
  1310. Player.Character[Name]["New Magazine"]:Remove()
  1311. wait(0.1)
  1312. if Player.Character:FindFirstChild("Torso") ~= nil then
  1313. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1314. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1315. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.3, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
  1316. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1317. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1318. else return false end
  1319. else return false end
  1320. Player.Character[Name].Handle.Reload:Stop()
  1321. wait(0.4)
  1322. Player.Character[Name].Handle.Empty:Play()
  1323. for i = 5, 0, -1 do
  1324. if Player.Character:FindFirstChild("Torso") ~= nil then
  1325. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1326. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1327. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
  1328. wait()
  1329. else return false end
  1330. else return false end
  1331. end
  1332. Player.Character[Name].Magazine2.Transparency = 0
  1333. wait(0.4)
  1334. Player.Character[Name].Handle.Lock:Play()
  1335. for i = 5, 0, -1 do
  1336. if Player.Character:FindFirstChild("Torso") ~= nil then
  1337. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1338. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1339. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
  1340. wait()
  1341. else return false end
  1342. else return false end
  1343. end
  1344. Player.Character[Name].TopC.Transparency = 0
  1345. Player.Character[Name].TopO.Transparency = 1
  1346. Player.Character[Name].Top2C.Transparency = 0
  1347. Player.Character[Name].Top2O.Transparency = 1
  1348. playAnimation("hold")
  1349. return true
  1350. end
  1351. if format == "fire" then
  1352. makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
  1353. if magazine.Value == 0 then
  1354. Player.Character[Name].Magazine2.Transparency = 1
  1355. else end
  1356. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  1357. if silenced then
  1358. Player.Character[Name].Handle.Fire2.Volume = math.random(3, 8) / 10
  1359. Player.Character[Name].Handle.Fire2.Pitch = math.random(2.4, 3)
  1360. Player.Character[Name].Handle.Fire2:Play()
  1361. CamShake(10, 90000)
  1362. else
  1363. Player.Character[Name].Handle.Fire.Volume = math.random(9, 10) / 10
  1364. Player.Character[Name].Handle.Fire.Pitch = math.random(1.6, 1.8)
  1365. Player.Character[Name].Handle.Fire:Play()
  1366. CamShake(10, 80000)
  1367. end
  1368. else return false end
  1369. if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  1370. if silenced == false then
  1371. coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end))
  1372. else end
  1373. else return false end
  1374. for i = 0, 10, 5 do
  1375. if Player.Character:FindFirstChild("Torso") ~= nil then
  1376. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1377. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1378. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.3, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
  1379. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1380. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1381. wait()
  1382. else return false end
  1383. else return false end
  1384. end
  1385. for i = 10, 0, -5 do
  1386. if Player.Character:FindFirstChild("Torso") ~= nil then
  1387. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1388. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1389. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.3, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
  1390. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1391. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1392. wait()
  1393. else return false end
  1394. else return false end
  1395. end
  1396. end
  1397. return true
  1398. end
  1399.  
  1400.  
  1401. function CamShake(time, freq)
  1402. coroutine.resume(coroutine.create(function()
  1403. local cam = game:GetService("Workspace").CurrentCamera
  1404. local time = 10
  1405. local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
  1406. if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
  1407. if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
  1408. 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)
  1409. for i = 1, time do
  1410. 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)
  1411. wait()
  1412. end
  1413. end))
  1414. end
  1415.  
  1416.  
  1417. function makeShell(part)
  1418. if part == nil then return false end
  1419. local casing = Instance.new("Part")
  1420. casing.Name = "Shell"
  1421. casing.formFactor = "Custom"
  1422. casing.Size = Vector3.new(0.2, 0.25, 0.2)
  1423. casing.CFrame = CFrame.new(part.Position) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, 360)), math.rad(math.random(0, 360)), math.rad(math.random(0, 360)))
  1424. casing.BrickColor = BrickColor.new("New Yeller")
  1425. local mesh = Instance.new("CylinderMesh")
  1426. mesh.Scale = Vector3.new(0.3, 1, 0.3)
  1427. mesh.Parent = casing
  1428. casing.Parent = game:GetService("Workspace")
  1429. casing:BreakJoints()
  1430. casing.Velocity = (part.CFrame.lookVector * 50) + Vector3.new(0, 10, 0)
  1431. coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end))
  1432. end
  1433.  
  1434.  
  1435. function Weld(x, y)
  1436. local weld = Instance.new("Weld")
  1437. weld.Part0 = x
  1438. weld.Part1 = y
  1439. CJ = CFrame.new(x.Position)
  1440. C0 = x.CFrame:inverse() * CJ
  1441. C1 = y.CFrame:inverse() * CJ
  1442. weld.C0 = C0
  1443. weld.C1 = C1
  1444. weld.Parent = x
  1445. end
  1446.  
  1447.  
  1448. function tagHumanoid(humanoid)
  1449. local tag = Instance.new("ObjectValue")
  1450. tag.Name = "creator"
  1451. tag.Value = Player
  1452. tag.Parent = humanoid
  1453. local tag = Instance.new("StringValue")
  1454. tag.Name = "creatorType1"
  1455. tag.Value = Name
  1456. tag.Parent = humanoid
  1457. local tag = Instance.new("StringValue")
  1458. tag.Name = "creatorType2"
  1459. tag.Value = "shot"
  1460. tag.Parent = humanoid
  1461. end
  1462.  
  1463.  
  1464. function untagHumanoid(humanoid)
  1465. if humanoid ~= nil then
  1466. local tag = humanoid:FindFirstChild("creator")
  1467. if tag ~= nil then
  1468. tag:Remove()
  1469. end
  1470. local tag = humanoid:FindFirstChild("creatorType1")
  1471. if tag ~= nil then
  1472. tag:Remove()
  1473. end
  1474. local tag = humanoid:FindFirstChild("creatorType2")
  1475. if tag ~= nil then
  1476. tag:Remove()
  1477. end
  1478. end
  1479. end
  1480.  
  1481.  
  1482. function fire(startPoint, endPoint, hit)
  1483. local trail = Instance.new("Part")
  1484. trail.Name = "Bullet Trail"
  1485. trail.BrickColor = BrickColor.new("New Yeller")
  1486. trail.TopSurface = 0
  1487. trail.BottomSurface = 0
  1488. trail.formFactor = 0
  1489. trail.Size = Vector3.new(1, 1, 1)
  1490. trail.Transparency = 0.8
  1491. trail.Anchored = true
  1492. trail.CanCollide = false
  1493. trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint)
  1494. trail.Parent = game:GetService("Workspace")
  1495. local mesh = Instance.new("SpecialMesh")
  1496. mesh.MeshType = "Brick"
  1497. mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - endPoint).magnitude)
  1498. mesh.Parent = trail
  1499. coroutine.resume(coroutine.create(function(part) for i = 1, 10 do part.Mesh.Scale = Vector3.new(part.Mesh.Scale.x - 0.01, part.Mesh.Scale.y - 0.01, part.Mesh.Scale.z) wait() end part:Remove() end), trail)
  1500. if hit ~= nil then
  1501. if hit.Parent == nil then return end
  1502. if hit.Parent:FindFirstChild("Humanoid") ~= nil then
  1503. tagHumanoid(hit.Parent.Humanoid)
  1504. if hit.Name == "Head" then
  1505. hit.Parent.Humanoid:TakeDamage(damage * 10)
  1506. elseif hit.Name == "Torso" then
  1507. hit.Parent.Humanoid:TakeDamage(damage * 2)
  1508. else
  1509. hit.Parent.Humanoid:TakeDamage(damage)
  1510. end
  1511. if math.random(1, 10) == 1 then
  1512. hit.Parent.Humanoid.Sit = true
  1513. end
  1514. delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end)
  1515. end
  1516. if hit.Anchored == false then
  1517. hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 2))
  1518. end
  1519. end
  1520. end
  1521.  
  1522.  
  1523. function onButton1Down(mouse)
  1524. if selected == false then return end
  1525. 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
  1526. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  1527. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1528. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
  1529. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
  1530. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1531. Button1Down = true
  1532. canFire = false
  1533. canFire2 = true
  1534. while canFire2 == true do
  1535. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1536. if humanoid == nil then
  1537. canFire2 = false
  1538. break
  1539. end
  1540. if humanoid.Health <= 0 then
  1541. canFire2 = false
  1542. break
  1543. end
  1544. local fireLeft = false
  1545. if automatic == false and burst == false then
  1546. canFire2 = false
  1547. elseif automatic == false and burst == true then
  1548. if burstCount >= burstCountMax then
  1549. canFire2 = false
  1550. burstCount = 0
  1551. break
  1552. end
  1553. burstCount = burstCount + 1
  1554. elseif automatic == true and burst == false then
  1555. fireLeft = true
  1556. end
  1557. if magazine.Value > 0 then
  1558. magazine.Value = magazine.Value - 1
  1559. updateGui()
  1560. if silenced == true then
  1561. CamShake(1, Spread)
  1562. else end
  1563. fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1564. coroutine.resume(coroutine.create(function()
  1565. if dual == true then
  1566. playAnimation("rightFire")
  1567. elseif dual == false then
  1568. playAnimation("fire")
  1569. end
  1570. end))
  1571. else
  1572. Player.Character[Name].Handle.Empty:Play()
  1573. end
  1574. if fireLeft == true and dual == true and automatic == true then
  1575. if magazine.Value > 0 then
  1576. coroutine.resume(coroutine.create(function()
  1577. wait(readyTime / 2)
  1578. magazine.Value = magazine.Value - 1
  1579. updateGui()
  1580. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1581. playAnimation("leftFire")
  1582. end))
  1583. else
  1584. coroutine.resume(coroutine.create(function()
  1585. wait(readyTime / 2)
  1586. Player.Character[Name].Handle.Empty:Play()
  1587. end))
  1588. end
  1589. end
  1590. wait(readyTime)
  1591. end
  1592. if magazine.Value ~= 0 then
  1593. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1594. else end
  1595. canFire = true
  1596. end
  1597. end
  1598.  
  1599.  
  1600. function onButton1Up(mouse)
  1601. if selected == false then return end
  1602. Button1Down = false
  1603. canFire2 = false
  1604. burstCount = 0
  1605. while canFire == false do wait() end
  1606. if dual == true and automatic == false then
  1607. if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
  1608. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1609. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1610. canFire = false
  1611. canFire2 = true
  1612. while canFire2 == true do
  1613. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1614. if humanoid == nil then
  1615. canFire2 = false
  1616. break
  1617. end
  1618. if humanoid.Health <= 0 then
  1619. canFire2 = false
  1620. break
  1621. end
  1622. if burst == false then
  1623. canFire2 = false
  1624. elseif burst == true then
  1625. if burstCount >= burstCountMax then
  1626. canFire2 = false
  1627. burstCount = 0
  1628. break
  1629. end
  1630. burstCount = burstCount + 1
  1631. end
  1632. if magazine.Value <= 0 then
  1633. Player.Character[Name].Handle.Empty:Play()
  1634. else
  1635. coroutine.resume(coroutine.create(function()
  1636. playAnimation("leftFire")
  1637. end))
  1638. magazine.Value = magazine.Value - 1
  1639. updateGui()
  1640. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1641. end
  1642. wait(readyTime)
  1643. end
  1644. if magazine.Value ~= 0 then
  1645. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1646. else end
  1647. canFire = true
  1648. end
  1649. end
  1650.  
  1651.  
  1652. function onKeyDown(key, mouse)
  1653. if selected == false then return end
  1654. key = key:lower()
  1655. if key == "q" and Button1Down == false and canFire == true then
  1656. if mouse.Target == nil then return end
  1657. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  1658. if dual == true then onKeyDown("t", mouse) end
  1659. onDeselected(mouse)
  1660. removeParts("RightHolster")
  1661. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  1662. end
  1663. end
  1664. if key == "e" and Button1Down == false and canFire == true and canSilence == true then
  1665. if silenced then
  1666. silenced = false
  1667. if Player.Character:FindFirstChild(Name) == nil then return end
  1668. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1669. if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
  1670. Player.Character[Name].Muzzle.Transparency = 1
  1671. Player.Character[Name].Muzzle.Name = "Silencer"
  1672. Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
  1673. if dual == true then
  1674. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1675. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
  1676. Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
  1677. Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
  1678. Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
  1679. end
  1680. else
  1681. silenced = true
  1682. if Player.Character:FindFirstChild(Name) == nil then return end
  1683. if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
  1684. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1685. Player.Character[Name].Silencer.Transparency = 0
  1686. Player.Character[Name].Muzzle.Name = "Muzzle 2"
  1687. Player.Character[Name].Silencer.Name = "Muzzle"
  1688. if dual == true then
  1689. if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
  1690. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1691. Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
  1692. Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
  1693. Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
  1694. end
  1695. end
  1696. end
  1697. if key == "r" and Button1Down == false and canFire == true then
  1698. if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then
  1699. canFire = false
  1700. burstCount = 0
  1701. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1702. if magazine.Value > 0 then ammo.Value = ammo.Value + magazine.Value magazine.Value = 0 end
  1703. updateGui()
  1704. if dual == true then
  1705. playAnimation("reloadDual")
  1706. elseif dual == false then
  1707. playAnimation("reload")
  1708. end
  1709. if ammo.Value - magazineMax.Value < 0 then
  1710. magazine.Value = ammo.Value
  1711. ammo.Value = 0
  1712. elseif ammo.Value - magazineMax.Value >= 0 then
  1713. ammo.Value = ammo.Value - magazineMax.Value
  1714. magazine.Value = magazine.Value + magazineMax.Value
  1715. end
  1716. updateGui()
  1717. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1718. canFire = true
  1719. end
  1720. end
  1721. if key == "t" and Button1Down == false and canFire == true and canDual == true then
  1722. canFire = false
  1723. if dual == false then
  1724. local weapon = nil
  1725. for _, p in pairs(Player.Backpack:GetChildren()) do
  1726. if p.Name == Name and p ~= script.Parent then weapon = p break end
  1727. end
  1728. if weapon ~= nil then
  1729. dual = true
  1730. weapon.Name = "Dual"
  1731. weapon.Parent = script
  1732. silenced = false
  1733. removeParts("RightHand")
  1734. makeParts("RightHand")
  1735. removeParts("RightHolster")
  1736. makeParts("LeftHolster")
  1737. playAnimation("leftEquip")
  1738. removeParts("LeftHolster")
  1739. makeParts("LeftHand")
  1740. magazineMax.Value = math.ceil(magazineMax.Value * 2)
  1741. ammoMax.Value = math.ceil(ammoMax.Value * 2)
  1742. magazine.Value = magazine.Value + weapon.Magazine.Value
  1743. ammo.Value = ammo.Value + weapon.Ammo.Value
  1744. updateGui()
  1745. end
  1746. elseif dual == true then
  1747. local weapon = script:FindFirstChild("Dual")
  1748. if weapon ~= nil then
  1749. dual = false
  1750. weapon.Name = Name
  1751. weapon.Parent = Player.Backpack
  1752. silenced = false
  1753. removeParts("RightHand")
  1754. makeParts("RightHand")
  1755. playAnimation("leftUnequip")
  1756. removeParts("LeftHand")
  1757. makeParts("RightHolster")
  1758. playAnimation("hold")
  1759. weapon.Magazine.Value = math.floor(magazine.Value / 2)
  1760. weapon.Ammo.Value = math.floor(ammo.Value / 2)
  1761. magazineMax.Value = math.ceil(magazineMax.Value / 2)
  1762. ammoMax.Value = math.ceil(ammoMax.Value / 2)
  1763. magazine.Value = math.ceil(magazine.Value / 2)
  1764. ammo.Value = math.ceil(ammo.Value / 2)
  1765. updateGui()
  1766. end
  1767. end
  1768. canFire = true
  1769. end
  1770. if key == "y" and canZoom == true then
  1771. if zoom == false then
  1772. zoom = true
  1773. local pos = mouse.Hit.p
  1774. local target = mouse.Target
  1775. local cam = game:GetService("Workspace").CurrentCamera
  1776. focus = Instance.new("Part", workspace)
  1777. focus.Anchored = true
  1778. focus.CanCollide = false
  1779. focus.Transparency = 1
  1780. focus.TopSurface = 0
  1781. focus.BottomSurface = 0
  1782. focus.formFactor = "Plate"
  1783. focus.Size = Vector3.new(0, 0, 0)
  1784. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
  1785. cam.CameraSubject = focus
  1786. cam.CameraType = "Attach"
  1787. while zoom == true and selected == true do
  1788. local set = false
  1789. if target ~= nil then
  1790. if target.Parent ~= nil then
  1791. if target.Anchored == false then
  1792. focus.CFrame = CFrame.new(target.CFrame.p) * (CFrame.new(Player.Character.Torso.CFrame.p, target.CFrame.p) - CFrame.new(Player.Character.Torso.CFrame.p, target.CFrame.p).p)
  1793. set = true
  1794. end
  1795. end
  1796. end
  1797. if set == false then
  1798. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
  1799. end
  1800. wait()
  1801. end
  1802. if focus ~= nil then focus:Remove() focus = nil end
  1803. local cam = game:GetService("Workspace").CurrentCamera
  1804. cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
  1805. cam.CameraType = "Custom"
  1806. else
  1807. zoom = false
  1808. end
  1809. end
  1810. if key == "u" and Button1Down == false and canFire == true then
  1811. if automatic == false and burst == false then
  1812. if switchToBurst == true then
  1813. burst = true
  1814. local m = Instance.new("Message", Player)
  1815. m.Text = "Burst"
  1816. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1817. delay(2.5, function() m:Remove() end)
  1818. elseif switchToAutomatic == true then
  1819. automatic = true
  1820. local m = Instance.new("Message", Player)
  1821. m.Text = "Automatic"
  1822. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1823. delay(2.5, function() m:Remove() end)
  1824. end
  1825. elseif automatic == false and burst == true then
  1826. if switchToAutomatic == true then
  1827. automatic = true
  1828. burst = false
  1829. local m = Instance.new("Message", Player)
  1830. m.Text = "Automatic"
  1831. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1832. delay(2.5, function() m:Remove() end)
  1833. elseif switchToSingle == true then
  1834. burst = false
  1835. local m = Instance.new("Message", Player)
  1836. m.Text = "Single"
  1837. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1838. delay(2.5, function() m:Remove() end)
  1839. end
  1840. elseif automatic == true and burst == false then
  1841. if switchToSingle == true then
  1842. automatic = false
  1843. local m = Instance.new("Message", Player)
  1844. m.Text = "Single"
  1845. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1846. delay(2.5, function() m:Remove() end)
  1847. elseif switchToBurst == true then
  1848. automatic = false
  1849. burst = true
  1850. local m = Instance.new("Message", Player)
  1851. m.Text = "Burst"
  1852. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1853. delay(2.5, function() m:Remove() end)
  1854. end
  1855. end
  1856. end
  1857. end
  1858.  
  1859.  
  1860. function onSelected(mouse)
  1861. if selected == true then return end
  1862. selected = true
  1863. Holstered = false
  1864. canFire = false
  1865. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1866. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1867. if Player.Character.WeaponActivated.Value == nil then break end
  1868. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1869. wait()
  1870. end
  1871. updateGui()
  1872. local weapon = Instance.new("ObjectValue")
  1873. weapon.Name = "WeaponActivated"
  1874. weapon.Value = script.Parent
  1875. weapon.Parent = Player.Character
  1876. DisableLimb(1, Player.Character)
  1877. DisableLimb(2, Player.Character)
  1878. ForceAngle(1, 0, Player.Character)
  1879. ForceAngle(2, 0, Player.Character)
  1880. if dual == true then
  1881. coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
  1882. playAnimation("rightEquip")
  1883. removeParts("LeftHolster")
  1884. makeParts("LeftHand")
  1885. else
  1886. playAnimation("equip")
  1887. end
  1888. removeParts("RightHolster")
  1889. makeParts("RightHand")
  1890. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  1891. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  1892. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  1893. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1894. canFire = true
  1895. end
  1896.  
  1897.  
  1898. function onDeselected(mouse)
  1899. if selected == false then return end
  1900. Holstered = true
  1901. Button1Down = false
  1902. while canFire == false do
  1903. wait()
  1904. end
  1905. selected = false
  1906. if dual == true then
  1907. if math.random(1, 2) == 1 then
  1908. coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
  1909. wait(math.random(1, 10) / 10)
  1910. playAnimation("rightUnequip")
  1911. else
  1912. coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
  1913. wait(math.random(1, 10) / 10)
  1914. playAnimation("leftUnequip")
  1915. end
  1916. removeParts("LeftHand")
  1917. makeParts("LeftHolster")
  1918. else
  1919. playAnimation("unequip")
  1920. end
  1921. removeParts("RightHand")
  1922. makeParts("RightHolster")
  1923. ForceAngle(1, 0, Player.Character)
  1924. ForceAngle(2, 0, Player.Character)
  1925. ResetLimbCFrame(1, Player.Character)
  1926. ResetLimbCFrame(2, Player.Character)
  1927. EnableLimb(1, Player.Character)
  1928. EnableLimb(2, Player.Character)
  1929. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  1930. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  1931. if Player.Character.WeaponActivated.Value == script.Parent then
  1932. Player.Character.WeaponActivated:Remove()
  1933. end
  1934. end
  1935. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1936. if Player.Character.WeaponActivated.Value == nil then break end
  1937. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1938. wait()
  1939. end
  1940. end
  1941.  
  1942.  
  1943. if script.Parent.className ~= "HopperBin" then
  1944. if Player == nil then print("Error: Player not found!") return end
  1945. Tool = Instance.new("HopperBin")
  1946. Tool.Name = Name
  1947. Tool.Parent = Player.Backpack
  1948. script.Name = "Main"
  1949. script.Parent = Tool
  1950. end wait() if script.Parent.className == "HopperBin" then
  1951. while script.Parent.Parent.className ~= "Backpack" do
  1952. wait()
  1953. end
  1954. if script.Parent:FindFirstChild("MagazineMax") == nil then
  1955. magazineMax = Instance.new("NumberValue")
  1956. magazineMax.Name = "MagazineMax"
  1957. magazineMax.Value = 50
  1958. magazineMax.Parent = script.Parent
  1959. else
  1960. magazineMax = script.Parent.MagazineMax
  1961. end
  1962. if script.Parent:FindFirstChild("Magazine") == nil then
  1963. magazine = Instance.new("NumberValue")
  1964. magazine.Name = "Magazine"
  1965. magazine.Value = 0
  1966. magazine.Parent = script.Parent
  1967. else
  1968. magazine = script.Parent.Magazine
  1969. end
  1970. if script.Parent:FindFirstChild("AmmoMax") == nil then
  1971. ammoMax = Instance.new("NumberValue")
  1972. ammoMax.Name = "AmmoMax"
  1973. ammoMax.Value = 200
  1974. ammoMax.Parent = script.Parent
  1975. else
  1976. ammoMax = script.Parent.AmmoMax
  1977. end
  1978. if script.Parent:FindFirstChild("Ammo") == nil then
  1979. ammo = Instance.new("NumberValue")
  1980. ammo.Name = "Ammo"
  1981. ammo.Value = script.Parent.AmmoMax.Value
  1982. ammo.Parent = script.Parent
  1983. else
  1984. ammo = script.Parent.Ammo
  1985. end
  1986. Player = script.Parent.Parent.Parent
  1987. makeParts("RightHolster")
  1988. script.Parent.Selected:connect(onSelected)
  1989. script.Parent.Deselected:connect(onDeselected)
  1990. end
  1991.  
  1992. --mediafire
Add Comment
Please, Sign In to add comment