Advertisement
lafur

Untitled

Jan 29th, 2019
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end --[[
  6. Tesla Cannon; fires a bolt of electricity bound to fry anyone or anything it hits.
  7. --]]
  8.  
  9.  
  10. if script == nil then return end
  11.  
  12.  
  13. Player = game:GetService("Players").LocalPlayer
  14. Char = Player.Character
  15. animate = Char:findFirstChild("Animate")
  16. if animate then
  17. animate:Destroy()
  18. end
  19.  
  20. Name = "TeslaGun"
  21. MC = BrickColor.new("Dark stone grey")
  22. DC = BrickColor.new("Black")
  23. GC = BrickColor.new("Black")
  24. MR = 0
  25. GR = 0
  26. WSPenalty = 5
  27. selected = false
  28. canDual = false
  29. dual = false
  30. Button1Down = false
  31. damage = 85
  32. canFire = true
  33. canFire2 = false
  34. readyTime = 0.12
  35. automatic = false
  36. burst = false
  37. burstCount = 0
  38. burstCountMax = 3
  39. canSilence = false
  40. silenced = false
  41. canZoom = true
  42. zoom = false
  43. switchToSingle = true
  44. switchToBurst = false
  45. switchToAutomatic = false
  46.  
  47.  
  48. ammoGui = Instance.new("ScreenGui")
  49. ammoGui.Name = Name
  50. local frame = Instance.new("Frame")
  51. frame.Name = "Frame"
  52. frame.Size = UDim2.new(0, 165, 0, 60)
  53. frame.Position = UDim2.new(0, 0, 1, -400)
  54. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  55. frame.BorderColor3 = Color3.new(0, 0, 0)
  56. frame.Parent = ammoGui
  57. local label = Instance.new("TextLabel")
  58. label.Name = "Weapon"
  59. label.Text = "Weapon: " ..Name
  60. label.Size = UDim2.new(1, 0, 0, 20)
  61. label.Position = UDim2.new(0, 0, 0, 0)
  62. label.BackgroundColor3 = Color3.new(1, 0, 0)
  63. label.BorderColor3 = Color3.new(0, 0, 0)
  64. label.Parent = frame
  65. local label = Instance.new("TextLabel")
  66. label.Name = "MagazinePrefix"
  67. label.Text = " Cell:"
  68. label.TextXAlignment = "Left"
  69. label.Size = UDim2.new(1, 0, 0, 20)
  70. label.Position = UDim2.new(0, 0, 0, 20)
  71. label.BackgroundColor3 = Color3.new(1, 1, 1)
  72. label.BorderColor3 = Color3.new(0, 0, 0)
  73. label.Parent = frame
  74. local label = Instance.new("TextLabel")
  75. label.Name = "Magazine"
  76. label.Text = "0/0"
  77. label.TextXAlignment = "Right"
  78. label.Size = UDim2.new(1, 0, 0, 20)
  79. label.Position = UDim2.new(0, -10, 0, 20)
  80. label.BackgroundTransparency = 1
  81. label.BorderSizePixel = 0
  82. label.Parent = frame
  83. local label = Instance.new("TextLabel")
  84. label.Name = "AmmoPrefix"
  85. label.Text = " EC Pack:"
  86. label.TextXAlignment = "Left"
  87. label.Size = UDim2.new(1, 0, 0, 20)
  88. label.Position = UDim2.new(0, 0, 0, 40)
  89. label.BackgroundColor3 = Color3.new(1, 1, 1)
  90. label.BorderColor3 = Color3.new(0, 0, 0)
  91. label.Parent = frame
  92. local label = Instance.new("TextLabel")
  93. label.Name = "Ammo"
  94. label.Text = "0/0"
  95. label.TextXAlignment = "Right"
  96. label.Size = UDim2.new(1, 0, 0, 20)
  97. label.Position = UDim2.new(0, -10, 0, 40)
  98. label.BackgroundTransparency = 1
  99. label.BorderSizePixel = 0
  100. label.Parent = frame
  101.  
  102.  
  103. function updateGui()
  104. if selected == false then return end
  105. if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
  106. if Player.PlayerGui:FindFirstChild(Name) == nil then
  107. ammoGui:Clone().Parent = Player.PlayerGui
  108. end
  109. Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
  110. Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
  111. end
  112.  
  113.  
  114. function makeParts(format)
  115. local model = Instance.new("Model")
  116. model.Name = Name
  117. local pm = Instance.new("Part")
  118. pm.Name = "Handle"
  119. pm.formFactor = "Symmetric"
  120. pm.Size = Vector3.new(1, 1, 1)
  121. pm.BrickColor = MC
  122. pm.Transparency = 1
  123. pm.CanCollide = false
  124. pm.Locked = true
  125. pm.TopSurface = 0
  126. pm.BottomSurface = 0
  127. pm.Parent = model
  128. local m = Instance.new("BlockMesh")
  129. m.Scale = Vector3.new(0.3, 1.1, 0.41)
  130. m.Offset = Vector3.new(0, -0.14, 0.07)
  131. m.Parent = pm
  132. if format ~= nil then
  133. local w = Instance.new("Weld")
  134. w.Part0 = pm
  135. if format == "RightHand" then
  136. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  137. w.C0 = CFrame.new(0, 1.5, 0.75)
  138. w.C1 = CFrame.new()
  139. elseif format == "RightHolster" then
  140. w.Part1 = Player.Character:FindFirstChild("Torso")
  141. w.C0 = CFrame.new(-0.65, 1, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-40), math.rad(90), 0)
  142. w.C1 = CFrame.new()
  143. model.Name = Name.. " (Holstered)"
  144. end
  145. w.Parent = pm
  146. model.Parent = Player.Character
  147. end
  148. --[[
  149. sniper1 http://www.roblox.com/asset/?id=1868836
  150. equip http://www.roblox.com/asset/?id=13510737
  151. fire1 http://www.roblox.com/asset/?id=2760979
  152. fire2 http://www.roblox.com/asset/?id=13510352
  153. fire3 http://www.roblox.com/asset/?id=2692806
  154. fire4 http://www.roblox.com/asset/?id=2691586
  155. fire5 http://www.roblox.com/asset/?id=2920959
  156. fire6 http://www.roblox.com/asset/?id=2697431
  157. fire7 http://www.roblox.com/asset/?id=2920959
  158. reload1 http://www.roblox.com/asset/?id=2691591
  159. reload2 http://www.roblox.com/asset/?id=2697432
  160. reload3 http://www.roblox.com/asset/?id=2920960
  161. reload4 http://www.roblox.com/asset/?id=2761842
  162. shotgun1 http://www.roblox.com/asset/?id=2697294
  163. --]]
  164. local s = Instance.new("Sound")
  165. s.Name = "Fire"
  166. s.SoundId = "http://roblox.com/asset/?id=10209268"
  167. s.Volume = 1
  168. s.Pitch = 1
  169. s.Looped = false
  170. s.Parent = pm
  171. local s = Instance.new("Sound")
  172. s.Name = "Lock"
  173. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  174. s.Volume = 1
  175. s.Pitch = 3
  176. s.Looped = false
  177. s.Parent = pm
  178. local s = Instance.new("Sound")
  179. s.Name = "Reload"
  180. s.SoundId = "http://www.roblox.com/asset/?id=2761842"
  181. s.Volume = 1
  182. s.Pitch = 1.1
  183. s.Looped = false
  184. s.Parent = pm
  185. local s = Instance.new("Sound")
  186. s.Name = "Empty"
  187. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  188. s.Volume = 1
  189. s.Pitch = 5
  190. s.Looped = false
  191. s.Parent = pm
  192. local s = Instance.new("Sound")
  193. s.Name = "Switch"
  194. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  195. s.Volume = 1
  196. s.Pitch = 10
  197. s.Looped = false
  198. s.Parent = pm
  199. local s = Instance.new("Sound")
  200. s.Name = "Equip"
  201. s.SoundId = "http://www.roblox.com/asset/?id=10209881"
  202. s.Volume = 1
  203. s.Pitch = 0.6
  204. s.Looped = false
  205. s.Parent = pm
  206. local p = Instance.new("Part")
  207. p.Name = "ShellOut"
  208. p.formFactor = "Symmetric"
  209. p.Size = Vector3.new(1, 1, 1)
  210. p.Transparency = 1
  211. p.Locked = true
  212. p.CanCollide = false
  213. p.TopSurface = 0
  214. p.BottomSurface = 0
  215. p.Parent = model
  216. local w = Instance.new("Weld")
  217. w.Part0 = p
  218. w.Part1 = pm
  219. w.C0 = CFrame.new(0, 0, 1) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  220. w.C1 = CFrame.new()
  221. w.Parent = p
  222. local p = Instance.new("Part")
  223. p.Name = "Grip"
  224. p.formFactor = "Symmetric"
  225. p.Size = Vector3.new(1, 1, 1)
  226. p.BrickColor = MC
  227. p.CanCollide = false
  228. p.Locked = true
  229. p.TopSurface = 0
  230. p.BottomSurface = 0
  231. p.Parent = model
  232. local m = Instance.new("SpecialMesh")
  233. m.MeshType = "Brick"
  234. m.Scale = Vector3.new(0.29, 0.35, 0.7)
  235. m.Parent = p
  236. local w = Instance.new("Weld")
  237. w.Part0 = p
  238. w.Part1 = pm
  239. w.C0 = CFrame.new(0, -0.7, -0.5)
  240. w.C1 = CFrame.new()
  241. w.Parent = p
  242. local p = Instance.new("Part")
  243. p.Name = "Trigger"
  244. p.formFactor = "Symmetric"
  245. p.Size = Vector3.new(1, 1, 1)
  246. p.BrickColor = BrickColor.new("Bright red")
  247. p.Locked = true
  248. p.CanCollide = false
  249. p.TopSurface = 0
  250. p.BottomSurface = 0
  251. p.Parent = model
  252. local m = Instance.new("SpecialMesh")
  253. m.MeshType = "Brick"
  254. m.Scale = Vector3.new(0.1, 0.05, 0.15)
  255. m.Parent = p
  256. local w = Instance.new("Weld")
  257. w.Part0 = p
  258. w.Part1 = pm
  259. w.C0 = CFrame.new(0, -0.5, -0.28)
  260. w.C1 = CFrame.new()
  261. w.Parent = p
  262. local p = Instance.new("Part")
  263. p.Name = "Bolt"
  264. p.formFactor = "Symmetric"
  265. p.Size = Vector3.new(1, 1, 1)
  266. p.BrickColor = BrickColor.new("Bright blue")
  267. p.Reflectance = 0.35
  268. p.Transparency = 1
  269. p.CanCollide = false
  270. p.Locked = true
  271. p.TopSurface = 0
  272. p.BottomSurface = 0
  273. p.Parent = model
  274. local m = Instance.new("SpecialMesh")
  275. m.MeshType = "Sphere"
  276. m.Scale = Vector3.new(2, 2, 2)
  277. m.Parent = p
  278. local w = Instance.new("Weld")
  279. w.Part0 = p
  280. w.Part1 = pm
  281. w.C0 = CFrame.new(0, 1, 0)
  282. w.C1 = CFrame.new()
  283. w.Parent = p
  284. local p = Instance.new("Part")
  285. p.Name = "Magazine"
  286. p.formFactor = "Symmetric"
  287. p.Size = Vector3.new(1, 1, 1)
  288. p.BrickColor = BrickColor.new("White")
  289. p.CanCollide = false
  290. p.Locked = true
  291. p.TopSurface = 0
  292. p.BottomSurface = 0
  293. p.Parent = model
  294. local m = Instance.new("CylinderMesh")
  295. m.Scale = Vector3.new(0.4, 0.8, 0.4)
  296. m.Parent = p
  297. local w = Instance.new("Weld")
  298. w.Part0 = p
  299. w.Part1 = pm
  300. w.C0 = CFrame.new(0, 0.11, -0.2) * CFrame.fromEulerAnglesXYZ(math.rad(-20), 0, 0)
  301. w.C1 = CFrame.new()
  302. w.Parent = p
  303. local p = Instance.new("Part")
  304. p.Name = "EndBack"
  305. p.formFactor = "Symmetric"
  306. p.Size = Vector3.new(1, 1, 1)
  307. p.BrickColor = GC
  308. p.CanCollide = false
  309. p.Locked = true
  310. p.TopSurface = 0
  311. p.BottomSurface = 0
  312. p.Parent = model
  313. local m = Instance.new("CylinderMesh")
  314. m.Scale = Vector3.new(0.65, 0.8, 0.64)
  315. m.Parent = p
  316. local w = Instance.new("Weld")
  317. w.Part0 = p
  318. w.Part1 = pm
  319. w.C0 = CFrame.new(0, 3.2, 0) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0)
  320. w.C1 = CFrame.new()
  321. w.Parent = p
  322. local p = Instance.new("Part")
  323. p.Name = "Center"
  324. p.formFactor = "Symmetric"
  325. p.Size = Vector3.new(1, 1, 1)
  326. p.BrickColor = MC
  327. p.CanCollide = false
  328. p.Locked = true
  329. p.TopSurface = 0
  330. p.BottomSurface = 0
  331. p.Parent = model
  332. local m = Instance.new("CylinderMesh")
  333. m.Scale = Vector3.new(0.5, 4, 0.5)
  334. m.Parent = p
  335. local w = Instance.new("Weld")
  336. w.Part0 = p
  337. w.Part1 = pm
  338. w.C0 = CFrame.new(0, -1.2, 0)
  339. w.C1 = CFrame.new()
  340. w.Parent = p
  341. local p = Instance.new("Part")
  342. p.Name = "Pipe"
  343. p.formFactor = "Symmetric"
  344. p.Size = Vector3.new(1, 1, 1)
  345. p.BrickColor = DC
  346. p.CanCollide = false
  347. p.Locked = true
  348. p.TopSurface = 0
  349. p.BottomSurface = 0
  350. p.Parent = model
  351. local m = Instance.new("CylinderMesh")
  352. m.Scale = Vector3.new(0.1, 4, 0.1)
  353. m.Parent = p
  354. local w = Instance.new("Weld")
  355. w.Part0 = p
  356. w.Part1 = pm
  357. w.C0 = CFrame.new(0.15, -1.2, 0.15)
  358. w.C1 = CFrame.new()
  359. w.Parent = p
  360. local p = Instance.new("Part")
  361. p.Name = "Pipe"
  362. p.formFactor = "Symmetric"
  363. p.Size = Vector3.new(1, 1, 1)
  364. p.BrickColor = DC
  365. p.CanCollide = false
  366. p.Locked = true
  367. p.TopSurface = 0
  368. p.BottomSurface = 0
  369. p.Parent = model
  370. local m = Instance.new("CylinderMesh")
  371. m.Scale = Vector3.new(0.1, 4, 0.1)
  372. m.Parent = p
  373. local w = Instance.new("Weld")
  374. w.Part0 = p
  375. w.Part1 = pm
  376. w.C0 = CFrame.new(-0.15, -1.2, 0.15)
  377. w.C1 = CFrame.new()
  378. w.Parent = p
  379. local p = Instance.new("Part")
  380. p.Name = "Pipe"
  381. p.formFactor = "Symmetric"
  382. p.Size = Vector3.new(1, 1, 1)
  383. p.BrickColor = DC
  384. p.CanCollide = false
  385. p.Locked = true
  386. p.TopSurface = 0
  387. p.BottomSurface = 0
  388. p.Parent = model
  389. local m = Instance.new("CylinderMesh")
  390. m.Scale = Vector3.new(0.1, 4, 0.1)
  391. m.Parent = p
  392. local w = Instance.new("Weld")
  393. w.Part0 = p
  394. w.Part1 = pm
  395. w.C0 = CFrame.new(0.15, -1.2, -0.15)
  396. w.C1 = CFrame.new()
  397. w.Parent = p
  398. local p = Instance.new("Part")
  399. p.Name = "Pipe"
  400. p.formFactor = "Symmetric"
  401. p.Size = Vector3.new(1, 1, 1)
  402. p.BrickColor = DC
  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("CylinderMesh")
  409. m.Scale = Vector3.new(0.1, 4, 0.1)
  410. m.Parent = p
  411. local w = Instance.new("Weld")
  412. w.Part0 = p
  413. w.Part1 = pm
  414. w.C0 = CFrame.new(-0.15, -1.2, -0.15)
  415. w.C1 = CFrame.new()
  416. w.Parent = p
  417. local p = Instance.new("Part")
  418. p.Name = "Stripe"
  419. p.formFactor = "Symmetric"
  420. p.Size = Vector3.new(1, 1, 1)
  421. p.BrickColor = BrickColor.new("Cyan")
  422. p.CanCollide = false
  423. p.Locked = true
  424. p.TopSurface = 0
  425. p.BottomSurface = 0
  426. p.Parent = model
  427. local m = Instance.new("CylinderMesh")
  428. m.Scale = Vector3.new(0.51, 0.4, 0.51)
  429. m.Parent = p
  430. local w = Instance.new("Weld")
  431. w.Part0 = p
  432. w.Part1 = pm
  433. w.C0 = CFrame.new(0, -1, 0)
  434. w.C1 = CFrame.new()
  435. w.Parent = p
  436. local p = Instance.new("Part")
  437. p.Name = "Muzzle"
  438. p.formFactor = "Symmetric"
  439. p.Size = Vector3.new(1, 1, 1)
  440. p.BrickColor = DC
  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.64, 0.8, 0.64)
  447. m.Parent = p
  448. local w = Instance.new("Weld")
  449. w.Part0 = p
  450. w.Part1 = pm
  451. w.C0 = CFrame.new(0, 1, 0)
  452. w.C1 = CFrame.new()
  453. w.Parent = p
  454. local s = Instance.new("Smoke")
  455. s.Enabled = false
  456. s.Name = "Smoke"
  457. s.RiseVelocity = 5
  458. s.Opacity = 0.2
  459. s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225)
  460. s.Size = 1
  461. s.Parent = p
  462. local f = Instance.new("Fire")
  463. f.Enabled = false
  464. f.Name = "Fire"
  465. f.Color = Color3.new(0 / 0, 0 / 0, 0 / 0)
  466. f.SecondaryColor = Color3.new(0 / 0, 0 / 0, 0 / 0)
  467. f.Heat = -35
  468. f.Size = 1
  469. f.Parent = p
  470. local p = Instance.new("Part")
  471. p.Name = "Silencer"
  472. p.formFactor = "Symmetric"
  473. p.Size = Vector3.new(1, 1, 1)
  474. p.BrickColor = BrickColor.new("Black")
  475. p.CanCollide = false
  476. p.Transparency = 1
  477. p.Locked = true
  478. p.TopSurface = 0
  479. p.BottomSurface = 0
  480. p.Parent = model
  481. local m = Instance.new("CylinderMesh")
  482. m.Scale = Vector3.new(0.25, 0.8, 0.25)
  483. m.Parent = p
  484. local w = Instance.new("Weld")
  485. w.Part0 = p
  486. w.Part1 = pm
  487. w.C0 = CFrame.new(0, 2.5, -0.04)
  488. w.C1 = CFrame.new()
  489. w.Parent = p
  490. local p = Instance.new("Part")
  491. p.Name = "Scope Base"
  492. p.formFactor = "Symmetric"
  493. p.Size = Vector3.new(1, 1, 1)
  494. p.BrickColor = MC
  495. p.Locked = true
  496. p.TopSurface = 0
  497. p.BottomSurface = 0
  498. p.Parent = model
  499. local m = Instance.new("BlockMesh")
  500. m.Scale = Vector3.new(0.1, 0.32, 0.4)
  501. m.Parent = p
  502. local w = Instance.new("Weld")
  503. w.Part0 = p
  504. w.Part1 = pm
  505. w.C0 = CFrame.new(0.1, 0, 0.36)
  506. w.C1 = CFrame.new()
  507. w.Parent = p
  508. local p = Instance.new("Part")
  509. p.Name = "Scope End 1" --End = Back
  510. p.formFactor = "Symmetric"
  511. p.Size = Vector3.new(1, 1, 1)
  512. p.BrickColor = MC
  513. p.Locked = true
  514. p.TopSurface = 0
  515. p.BottomSurface = 0
  516. p.Parent = model
  517. local m = Instance.new("BlockMesh")
  518. m.Scale = Vector3.new(0.36, 0.4, 0.26)
  519. m.Parent = p
  520. local w = Instance.new("Weld")
  521. w.Part0 = p
  522. w.Part1 = pm
  523. w.C0 = CFrame.new(0, -0.4, 0.475)
  524. w.C1 = CFrame.new()
  525. w.Parent = p
  526. local p = Instance.new("Part")
  527. p.Name = "Scope End W" --End = Back
  528. p.formFactor = "Symmetric"
  529. p.Size = Vector3.new(1, 1, 1)
  530. p.BrickColor = BrickColor.new("Lime green")
  531. p.Reflectance = 0.5
  532. p.Locked = true
  533. p.TopSurface = 0
  534. p.BottomSurface = 0
  535. p.Parent = model
  536. local m = Instance.new("BlockMesh")
  537. m.Scale = Vector3.new(0.3, 0.4, 0.2)
  538. m.Parent = p
  539. local w = Instance.new("Weld")
  540. w.Part0 = p
  541. w.Part1 = pm
  542. w.C0 = CFrame.new(0, -0.402, 0.475)
  543. w.C1 = CFrame.new()
  544. w.Parent = p
  545. local p = Instance.new("Part")
  546. p.Name = "Scope Front W"
  547. p.formFactor = "Symmetric"
  548. p.Size = Vector3.new(1, 1, 1)
  549. p.BrickColor = BrickColor.new("Lime green")
  550. p.Reflectance = 0.5
  551. p.Locked = true
  552. p.TopSurface = 0
  553. p.BottomSurface = 0
  554. p.Parent = model
  555. local m = Instance.new("BlockMesh")
  556. m.Scale = Vector3.new(0.3, 0.4, 0.2)
  557. m.Parent = p
  558. local w = Instance.new("Weld")
  559. w.Part0 = p
  560. w.Part1 = pm
  561. w.C0 = CFrame.new(0, 0.502, 0.475)
  562. w.C1 = CFrame.new()
  563. w.Parent = p
  564. local p = Instance.new("Part")
  565. p.Name = "Scope Center 1"
  566. p.formFactor = "Symmetric"
  567. p.Size = Vector3.new(1, 1, 1)
  568. p.BrickColor = MC
  569. p.Locked = true
  570. p.TopSurface = 0
  571. p.BottomSurface = 0
  572. p.Parent = model
  573. local m = Instance.new("BlockMesh")
  574. m.Scale = Vector3.new(0.3, 0.7, 0.22)
  575. m.Parent = p
  576. local w = Instance.new("Weld")
  577. w.Part0 = p
  578. w.Part1 = pm
  579. w.C0 = CFrame.new(0, 0, 0.475)
  580. w.C1 = CFrame.new()
  581. w.Parent = p
  582. local p = Instance.new("Part")
  583. p.Name = "Scope Front 1"
  584. p.formFactor = "Symmetric"
  585. p.Size = Vector3.new(1, 1, 1)
  586. p.BrickColor = MC
  587. p.Locked = true
  588. p.TopSurface = 0
  589. p.BottomSurface = 0
  590. p.Parent = model
  591. local m = Instance.new("BlockMesh")
  592. m.Scale = Vector3.new(0.36, 0.4, 0.26)
  593. m.Parent = p
  594. local w = Instance.new("Weld")
  595. w.Part0 = p
  596. w.Part1 = pm
  597. w.C0 = CFrame.new(0, 0.5, 0.475)
  598. w.C1 = CFrame.new()
  599. w.Parent = p
  600. return model
  601. end
  602.  
  603.  
  604. function removeParts(format)
  605. if format == "RightHand" then
  606. pcall(function() Player.Character[Name]:Remove() end)
  607. elseif format == "LeftHand" then
  608. pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
  609. elseif format == "RightHolster" then
  610. pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
  611. elseif format == "LeftHolster" then
  612. pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
  613. end
  614. end
  615.  
  616.  
  617. function SetAngle(Joint, Angle, Character)
  618. if Character == nil then return false end
  619. local Joints = {
  620. Character.Torso:FindFirstChild("Right Shoulder 2"),
  621. Character.Torso:FindFirstChild("Left Shoulder 2"),
  622. Character.Torso:FindFirstChild("Right Hip 2"),
  623. Character.Torso:FindFirstChild("Left Hip 2")
  624. }
  625. if Joints[Joint] == nil then return false end
  626. if Joint == 1 or Joint == 3 then
  627. Joints[Joint].DesiredAngle = Angle
  628. end
  629. if Joint == 2 or Joint == 4 then
  630. Joints[Joint].DesiredAngle = -Angle
  631. end
  632. end
  633.  
  634.  
  635. function ForceAngle(Joint, Angle, Character)
  636. if Character == nil then return false end
  637. local Joints = {
  638. Character.Torso:FindFirstChild("Right Shoulder 2"),
  639. Character.Torso:FindFirstChild("Left Shoulder 2"),
  640. Character.Torso:FindFirstChild("Right Hip 2"),
  641. Character.Torso:FindFirstChild("Left Hip 2")
  642. }
  643. if Joints[Joint] == nil then return false end
  644. if Joint == 1 or Joint == 3 then
  645. Joints[Joint].DesiredAngle = Angle
  646. Joints[Joint].CurrentAngle = Angle
  647. end
  648. if Joint == 2 or Joint == 4 then
  649. Joints[Joint].DesiredAngle = -Angle
  650. Joints[Joint].CurrentAngle = -Angle
  651. end
  652. end
  653.  
  654.  
  655. function SetSpeed(Joint, Speed, Character)
  656. if Character == nil then return false end
  657. local Joints = {
  658. Character.Torso:FindFirstChild("Right Shoulder 2"),
  659. Character.Torso:FindFirstChild("Left Shoulder 2"),
  660. Character.Torso:FindFirstChild("Right Hip 2"),
  661. Character.Torso:FindFirstChild("Left Hip 2")
  662. }
  663. if Joints[Joint] == nil then return false end
  664. Joints[Joint].MaxVelocity = Speed
  665. end
  666.  
  667.  
  668. function DisableLimb(Limb, Character)
  669. if Character == nil then return false end
  670. if Character:FindFirstChild("Torso") == nil then return false end
  671. local Joints = {
  672. Character.Torso:FindFirstChild("Right Shoulder"),
  673. Character.Torso:FindFirstChild("Left Shoulder"),
  674. Character.Torso:FindFirstChild("Right Hip"),
  675. Character.Torso:FindFirstChild("Left Hip")
  676. }
  677. local Limbs = {
  678. Character:FindFirstChild("Right Arm"),
  679. Character:FindFirstChild("Left Arm"),
  680. Character:FindFirstChild("Right Leg"),
  681. Character:FindFirstChild("Left Leg")
  682. }
  683. if Joints[Limb] == nil then return false end
  684. if Limbs[Limb] == nil then return false end
  685. local Joint = Instance.new("Motor")
  686. Joint.Parent = Character.Torso
  687. Joint.Part0 = Character.Torso
  688. Joint.Part1 = Limbs[Limb]
  689. if Limb == 1 then
  690. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  691. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  692. Joint.Name = "Right Shoulder 2"
  693. elseif Limb == 2 then
  694. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  695. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  696. Joint.Name = "Left Shoulder 2"
  697. elseif Limb == 3 then
  698. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  699. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  700. Joint.Name = "Right Hip 2"
  701. elseif Limb == 4 then
  702. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  703. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  704. Joint.Name = "Left Hip 2"
  705. end
  706. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  707. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  708. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  709. Joints[Limb]:Remove()
  710. end
  711.  
  712.  
  713. function ResetLimbCFrame(Limb, Character)
  714. if Character == nil then return false end
  715. if Character.Parent == nil then return false end
  716. if Character:FindFirstChild("Torso") == nil then return false end
  717. local Joints = {
  718. Character.Torso:FindFirstChild("Right Shoulder 2"),
  719. Character.Torso:FindFirstChild("Left Shoulder 2"),
  720. Character.Torso:FindFirstChild("Right Hip 2"),
  721. Character.Torso:FindFirstChild("Left Hip 2")
  722. }
  723. local Limbs = {
  724. Character:FindFirstChild("Right Arm"),
  725. Character:FindFirstChild("Left Arm"),
  726. Character:FindFirstChild("Right Leg"),
  727. Character:FindFirstChild("Left Leg")
  728. }
  729. if Joints[Limb] == nil then return false end
  730. if Limbs[Limb] == nil then return false end
  731. if Limb == 1 then
  732. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  733. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  734. elseif Limb == 2 then
  735. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  736. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  737. elseif Limb == 3 then
  738. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  739. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  740. elseif Limb == 4 then
  741. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  742. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  743. end
  744. end
  745.  
  746.  
  747. function EnableLimb(Limb, Character)
  748. if Character == nil then return false end
  749. if Character:FindFirstChild("Torso") == nil then return false end
  750. local Joints = {
  751. Character.Torso:FindFirstChild("Right Shoulder 2"),
  752. Character.Torso:FindFirstChild("Left Shoulder 2"),
  753. Character.Torso:FindFirstChild("Right Hip 2"),
  754. Character.Torso:FindFirstChild("Left Hip 2")
  755. }
  756. local Limbs = {
  757. Character:FindFirstChild("Right Arm"),
  758. Character:FindFirstChild("Left Arm"),
  759. Character:FindFirstChild("Right Leg"),
  760. Character:FindFirstChild("Left Leg")
  761. }
  762. if Joints[Limb] == nil then return false end
  763. if Limbs[Limb] == nil then return false end
  764. if Limb == 1 then
  765. Joints[Limb].Name = "Right Shoulder"
  766. elseif Limb == 2 then
  767. Joints[Limb].Name = "Left Shoulder"
  768. elseif Limb == 3 then
  769. Joints[Limb].Name = "Right Hip"
  770. elseif Limb == 4 then
  771. Joints[Limb].Name = "Left Hip"
  772. end
  773. Animate = Character:FindFirstChild("Animate")
  774. if Animate == nil then return false end
  775. Animate = Animate:Clone()
  776. Character.Animate:Remove()
  777. Animate.Parent = Character
  778. end
  779.  
  780.  
  781. function playAnimation(format, mouse)
  782. if format == "equip" then
  783. Player.Character.Humanoid.WalkSpeed = WSPenalty
  784. Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove()
  785. local w = Instance.new("Weld")
  786. w.Part0 = Player.Character[Name.. " (Holstered)"].Handle
  787. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  788. w.C0 = CFrame.new(0, 1.2, 0.7)
  789. w.C1 = CFrame.new()
  790. w.Parent = Player.Character[Name.. " (Holstered)"].Handle
  791. for i = 0.01, 1, 0.1 do
  792. if Player.Character:FindFirstChild("Torso") ~= nil then
  793. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  794. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  795. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.5 * i) + (1.5 * (1 - i)), 1.2 * i, 0.8 * i) * CFrame.fromEulerAnglesXYZ(math.rad(300 + ((1 - i) * 50)), math.rad(10), math.rad(-90) * i)
  796. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  797. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-0.9 * i) + (-1.5 * (1 - i)), -0.35 * i, 0.51 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  798. wait()
  799. else return false end
  800. else return false end
  801. end
  802. return playAnimation("hold")
  803. end
  804. if format == "unequip" then
  805. Player.Character.Humanoid.WalkSpeed = 16
  806. for i = 1, 0.01, -0.1 do
  807. if Player.Character:FindFirstChild("Torso") ~= nil then
  808. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  809. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  810. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.5 * i) + (1.5 * (1 - i)), 1.2 * i, 0.8 * i) * CFrame.fromEulerAnglesXYZ(math.rad(300 + ((1 - i) * 50)), math.rad(10), math.rad(-90) * i)
  811. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  812. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-0.9 * i) + (-1.5 * (1 - i)), -0.35 * i, 0.51 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  813. wait()
  814. else return false end
  815. else return false end
  816. end
  817. return true
  818. end
  819. if format == "hold" then
  820. if Player.Character:FindFirstChild("Torso") ~= nil then
  821. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  822. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  823. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
  824. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  825. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  826. else return false end
  827. else return false end
  828. end
  829. if format == "reload" then
  830. for i = 0, 25, 5 do
  831. if Player.Character:FindFirstChild("Torso") ~= nil then
  832. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  833. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  834. 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)
  835. wait()
  836. else return false end
  837. else return false end
  838. end
  839. Player.Character[Name].Handle.Reload:Play()
  840. Player.Character[Name].Magazine.Transparency = 1
  841. magazineDrop = Player.Character[Name].Magazine:Clone()
  842. magazineDrop.Transparency = 0
  843. magazineDrop.CanCollide = true
  844. magazineDrop.Parent = game.Workspace
  845. 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)
  846. delay(0.1, function() magazineDrop.CanCollide = true end)
  847. for i = 0, 25, 5 do
  848. if Player.Character:FindFirstChild("Torso") ~= nil then
  849. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  850. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  851. 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))
  852. wait()
  853. else return false end
  854. else return false end
  855. end
  856. magazineNew = Player.Character[Name].Magazine:Clone()
  857. magazineNew.Name = "New Magazine"
  858. magazineNew.Transparency = 0
  859. magazineNew.Parent = Player.Character[Name]
  860. local w = Instance.new("Weld")
  861. w.Part0 = magazineNew
  862. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  863. w.C0 = CFrame.new(0, 1.1, 0)
  864. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  865. w.Parent = magazineNew
  866. wait(0.2)
  867. for i = 25, 0, -5 do
  868. if Player.Character:FindFirstChild("Torso") ~= nil then
  869. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  870. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  871. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 + ((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))
  872. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  873. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1 + ((25 - i) / 30), 0.5, 0.6 + ((25 - i) / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), math.rad((25 * 2) - (i * 2)))
  874. wait()
  875. else return false end
  876. else return false end
  877. end
  878. Player.Character[Name].Magazine.Transparency = 0
  879. Player.Character[Name]["New Magazine"]:Remove()
  880. wait(0.1)
  881. if Player.Character:FindFirstChild("Torso") ~= nil then
  882. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  883. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  884. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
  885. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  886. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  887. else return false end
  888. else return false end
  889. wait(0.7)
  890. Player.Character[Name].Handle.Reload:Stop()
  891. end
  892. if format == "fire" then
  893. Player.Character[Name].Bolt.Transparency = 0.8
  894. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  895. if silenced then
  896. Player.Character[Name].Handle.Fire.Volume = math.random(3, 8) / 10
  897. Player.Character[Name].Handle.Fire.Pitch = math.random(20, 25) / 10
  898. Player.Character[Name].Handle.Fire:Play()
  899. CamShake(100, 5000)
  900. else
  901. Player.Character[Name].Handle.Fire.Volume = math.random(9, 10) / 10
  902. Player.Character[Name].Handle.Fire.Pitch = 1
  903. Player.Character[Name].Handle.Fire:Play()
  904. --Player.Character[Name].Handle.Fire2:Play()
  905. CamShake(10, 5000)
  906. end
  907. else return false end
  908. if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  909. coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.8) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end))
  910. else return false end
  911. for i = 0, 10, 5 do
  912. if Player.Character:FindFirstChild("Torso") ~= nil then
  913. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  914. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  915. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
  916. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  917. 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)
  918. wait()
  919. else return false end
  920. else return false end
  921. end
  922. for i = 10, 0, -5 do
  923. if Player.Character:FindFirstChild("Torso") ~= nil then
  924. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  925. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  926. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10 + i), math.rad(-90))
  927. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  928. 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)
  929. wait()
  930. else return false end
  931. else return false end
  932. end
  933. Player.Character[Name].Bolt.Transparency = 1
  934. end
  935. return true
  936. end
  937.  
  938.  
  939. function CamShake(time, freq)
  940. coroutine.resume(coroutine.create(function()
  941. local cam = game:GetService("Workspace").CurrentCamera
  942. local time = 10
  943. local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
  944. if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
  945. if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
  946. 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)
  947. for i = 1, time do
  948. 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)
  949. wait()
  950. end
  951. end))
  952. end
  953.  
  954.  
  955. function makeShell(part)
  956. if part == nil then return false end
  957. local casing = Instance.new("Part")
  958. casing.Name = "Shell"
  959. casing.formFactor = "Custom"
  960. casing.Size = Vector3.new(0.2, 0.25, 0.2)
  961. 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)))
  962. casing.BrickColor = BrickColor.new("White")
  963. local mesh = Instance.new("CylinderMesh")
  964. mesh.Scale = Vector3.new(0.6, 1, 0.6)
  965. mesh.Parent = casing
  966. casing.Parent = game:GetService("Workspace")
  967. casing:BreakJoints()
  968. casing.Velocity = (part.CFrame.lookVector * 50) + Vector3.new(-10, 0, 0)
  969. coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end))
  970. end
  971.  
  972.  
  973. function Weld(x, y)
  974. local weld = Instance.new("Weld")
  975. weld.Part0 = x
  976. weld.Part1 = y
  977. CJ = CFrame.new(x.Position)
  978. C0 = x.CFrame:inverse() * CJ
  979. C1 = y.CFrame:inverse() * CJ
  980. weld.C0 = C0
  981. weld.C1 = C1
  982. weld.Parent = x
  983. end
  984.  
  985.  
  986. function tagHumanoid(humanoid)
  987. local tag = Instance.new("ObjectValue")
  988. tag.Name = "creator"
  989. tag.Value = Player
  990. tag.Parent = humanoid
  991. local tag = Instance.new("StringValue")
  992. tag.Name = "creatorType1"
  993. tag.Value = Name
  994. tag.Parent = humanoid
  995. local tag = Instance.new("StringValue")
  996. tag.Name = "creatorType2"
  997. tag.Value = "shot"
  998. tag.Parent = humanoid
  999. end
  1000.  
  1001.  
  1002. function untagHumanoid(humanoid)
  1003. if humanoid ~= nil then
  1004. local tag = humanoid:FindFirstChild("creator")
  1005. if tag ~= nil then
  1006. tag:Remove()
  1007. end
  1008. local tag = humanoid:FindFirstChild("creatorType1")
  1009. if tag ~= nil then
  1010. tag:Remove()
  1011. end
  1012. local tag = humanoid:FindFirstChild("creatorType2")
  1013. if tag ~= nil then
  1014. tag:Remove()
  1015. end
  1016. end
  1017. end
  1018.  
  1019.  
  1020. function fire(startPoint, endPoint, hit)
  1021. local trail = Instance.new("Part")
  1022. trail.Name = "Bullet Trail"
  1023. trail.BrickColor = BrickColor.new("Bright blue")
  1024. trail.TopSurface = 0
  1025. trail.BottomSurface = 0
  1026. trail.formFactor = 0
  1027. trail.Size = Vector3.new(1, 1, 1)
  1028. trail.Transparency = 0.8
  1029. trail.Reflectance = 0.35
  1030. trail.Anchored = true
  1031. trail.CanCollide = false
  1032. trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint)
  1033. trail.Parent = game:GetService("Workspace")
  1034. local mesh = Instance.new("SpecialMesh")
  1035. mesh.MeshType = "Brick"
  1036. mesh.Scale = Vector3.new(0.5, 0.5, (startPoint - endPoint).magnitude)
  1037. mesh.Parent = trail
  1038. 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)
  1039. if hit ~= nil then
  1040. if hit.Parent == nil then return end
  1041. if hit.Parent:FindFirstChild("Humanoid") ~= nil then
  1042. tagHumanoid(hit.Parent.Humanoid)
  1043. if hit.Name == "Head" then
  1044. hit.Parent.Humanoid:TakeDamage(damage * 10)
  1045. local e = Instance.new("Explosion")
  1046. e.BlastPressure = 10000000
  1047. e.BlastRadius = 4
  1048. e.Position = hit.Position
  1049. e.Parent = game:GetService("Workspace")
  1050. elseif hit.Name == "Torso" then
  1051. hit.Parent.Humanoid:TakeDamage(damage * 2)
  1052. local e = Instance.new("Explosion")
  1053. e.BlastPressure = 10000000
  1054. e.BlastRadius = 4
  1055. e.Position = hit.Position
  1056. e.Parent = game:GetService("Workspace")
  1057. else
  1058. hit.Parent.Humanoid:TakeDamage(damage)
  1059. local e = Instance.new("Explosion")
  1060. e.BlastPressure = 10000000
  1061. e.BlastRadius = 4
  1062. e.Position = hit.Position
  1063. e.Parent = game:GetService("Workspace")
  1064. end
  1065. if HP == true then
  1066. hit.Parent.Humanoid.Sit = true
  1067. end
  1068. delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end)
  1069. end
  1070. if hit.Anchored == false then
  1071. hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 10))
  1072. end
  1073. end
  1074. end
  1075.  
  1076.  
  1077. function onButton1Down(mouse)
  1078. if selected == false then return end
  1079. 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
  1080. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  1081. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1082. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
  1083. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
  1084. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1085. Button1Down = true
  1086. canFire = false
  1087. canFire2 = true
  1088. while canFire2 == true do
  1089. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1090. if humanoid == nil then
  1091. canFire2 = false
  1092. break
  1093. end
  1094. if humanoid.Health <= 0 then
  1095. canFire2 = false
  1096. break
  1097. end
  1098. local fireLeft = false
  1099. if automatic == false and burst == false then
  1100. canFire2 = false
  1101. elseif automatic == false and burst == true then
  1102. if burstCount >= burstCountMax then
  1103. canFire2 = false
  1104. burstCount = 0
  1105. break
  1106. end
  1107. burstCount = burstCount + 1
  1108. elseif automatic == true and burst == false then
  1109. fireLeft = true
  1110. end
  1111. if magazine.Value > 0 then
  1112. magazine.Value = magazine.Value - 1
  1113. updateGui()
  1114. fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1115. coroutine.resume(coroutine.create(function()
  1116. if dual == true then
  1117. playAnimation("rightFire")
  1118. elseif dual == false then
  1119. playAnimation("fire")
  1120. end
  1121. end))
  1122. else
  1123. Player.Character[Name].Handle.Empty:Play()
  1124. --Player.Character[Name].BoltB.Transparency = 0
  1125. --Player.Character[Name].BoltC.Transparency = 1
  1126. end
  1127. if fireLeft == true and dual == true and automatic == true then
  1128. if magazine.Value > 0 then
  1129. coroutine.resume(coroutine.create(function()
  1130. wait(readyTime / 2)
  1131. magazine.Value = magazine.Value - 1
  1132. updateGui()
  1133. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1134. playAnimation("leftFire")
  1135. end))
  1136. else
  1137. coroutine.resume(coroutine.create(function()
  1138. wait(readyTime / 2)
  1139. Player.Character[Name].Handle.Empty:Play()
  1140. end))
  1141. end
  1142. end
  1143. wait(readyTime)
  1144. end
  1145. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1146. canFire = true
  1147. end
  1148. end
  1149.  
  1150.  
  1151. function onButton1Up(mouse)
  1152. if selected == false then return end
  1153. Button1Down = false
  1154. canFire2 = false
  1155. burstCount = 0
  1156. while canFire == false do wait() end
  1157. if dual == true and automatic == false then
  1158. if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
  1159. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1160. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1161. canFire = false
  1162. canFire2 = true
  1163. while canFire2 == true do
  1164. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1165. if humanoid == nil then
  1166. canFire2 = false
  1167. break
  1168. end
  1169. if humanoid.Health <= 0 then
  1170. canFire2 = false
  1171. break
  1172. end
  1173. if burst == false then
  1174. canFire2 = false
  1175. elseif burst == true then
  1176. if burstCount >= burstCountMax then
  1177. canFire2 = false
  1178. burstCount = 0
  1179. break
  1180. end
  1181. burstCount = burstCount + 1
  1182. end
  1183. if magazine.Value <= 0 then
  1184. Player.Character[Name].Handle.Empty:Play()
  1185. else
  1186. coroutine.resume(coroutine.create(function()
  1187. playAnimation("leftFire")
  1188. end))
  1189. magazine.Value = magazine.Value - 1
  1190. updateGui()
  1191. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1192. end
  1193. wait(readyTime)
  1194. end
  1195. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1196. canFire = true
  1197. end
  1198. end
  1199.  
  1200.  
  1201. function onKeyDown(key, mouse)
  1202. if selected == false then return end
  1203. key = key:lower()
  1204. if key == "q" and Button1Down == false and canFire == true then
  1205. if mouse.Target == nil then return end
  1206. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  1207. if dual == true then onKeyDown("t", mouse) end
  1208. onDeselected(mouse)
  1209. removeParts("RightHolster")
  1210. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  1211. end
  1212. end
  1213. if key == "e" and Button1Down == false and canFire == true and canSilence == true then
  1214. if silenced then
  1215. silenced = false
  1216. if Player.Character:FindFirstChild(Name) == nil then return end
  1217. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1218. if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
  1219. Player.Character[Name].Muzzle.Transparency = 1
  1220. Player.Character[Name].Muzzle.Name = "Silencer"
  1221. Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
  1222. if dual == true then
  1223. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1224. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
  1225. Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
  1226. Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
  1227. Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
  1228. end
  1229. else
  1230. silenced = true
  1231. if Player.Character:FindFirstChild(Name) == nil then return end
  1232. if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
  1233. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1234. Player.Character[Name].Silencer.Transparency = 0
  1235. Player.Character[Name].Muzzle.Name = "Muzzle 2"
  1236. Player.Character[Name].Silencer.Name = "Muzzle"
  1237. if dual == true then
  1238. if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
  1239. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1240. Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
  1241. Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
  1242. Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
  1243. end
  1244. end
  1245. end
  1246. if key == "r" and Button1Down == false and canFire == true then
  1247. if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then
  1248. canFire = false
  1249. burstCount = 0
  1250. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1251. if magazine.Value > 0 then ammo.Value = ammo.Value + magazine.Value magazine.Value = 0 end
  1252. updateGui()
  1253. if dual == true then
  1254. playAnimation("reloadDual")
  1255. elseif dual == false then
  1256. playAnimation("reload")
  1257. end
  1258. if ammo.Value - magazineMax.Value < 0 then
  1259. magazine.Value = ammo.Value
  1260. ammo.Value = 0
  1261. elseif ammo.Value - magazineMax.Value >= 0 then
  1262. ammo.Value = ammo.Value - magazineMax.Value
  1263. magazine.Value = magazineMax.Value
  1264. end
  1265. updateGui()
  1266. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1267. canFire = true
  1268. end
  1269. end
  1270. if key == "t" and Button1Down == false and canFire == true and canDual == true then
  1271. canFire = false
  1272. if dual == false then
  1273. local weapon = nil
  1274. for _, p in pairs(Player.Backpack:GetChildren()) do
  1275. if p.Name == Name and p ~= script.Parent then weapon = p break end
  1276. end
  1277. if weapon ~= nil then
  1278. dual = true
  1279. weapon.Name = "Dual"
  1280. weapon.Parent = script
  1281. silenced = false
  1282. removeParts("RightHand")
  1283. makeParts("RightHand")
  1284. removeParts("RightHolster")
  1285. makeParts("LeftHolster")
  1286. playAnimation("leftEquip")
  1287. removeParts("LeftHolster")
  1288. makeParts("LeftHand")
  1289. magazineMax.Value = math.ceil(magazineMax.Value * 2)
  1290. ammoMax.Value = math.ceil(ammoMax.Value * 2)
  1291. magazine.Value = magazine.Value + weapon.Magazine.Value
  1292. ammo.Value = ammo.Value + weapon.Ammo.Value
  1293. updateGui()
  1294. end
  1295. elseif dual == true then
  1296. local weapon = script:FindFirstChild("Dual")
  1297. if weapon ~= nil then
  1298. dual = false
  1299. weapon.Name = Name
  1300. weapon.Parent = Player.Backpack
  1301. silenced = false
  1302. removeParts("RightHand")
  1303. makeParts("RightHand")
  1304. playAnimation("leftUnequip")
  1305. removeParts("LeftHand")
  1306. makeParts("RightHolster")
  1307. playAnimation("hold")
  1308. weapon.Magazine.Value = math.floor(magazine.Value / 2)
  1309. weapon.Ammo.Value = math.floor(ammo.Value / 2)
  1310. magazineMax.Value = math.ceil(magazineMax.Value / 2)
  1311. ammoMax.Value = math.ceil(ammoMax.Value / 2)
  1312. magazine.Value = math.ceil(magazine.Value / 2)
  1313. ammo.Value = math.ceil(ammo.Value / 2)
  1314. updateGui()
  1315. end
  1316. end
  1317. canFire = true
  1318. end
  1319. if key == "y" and canZoom == true then
  1320. if zoom == false then
  1321. zoom = true
  1322. local pos = mouse.Hit.p
  1323. local target = mouse.Target
  1324. local cam = game:GetService("Workspace").CurrentCamera
  1325. focus = Instance.new("Part", workspace)
  1326. focus.Anchored = true
  1327. focus.CanCollide = false
  1328. focus.Transparency = 1
  1329. focus.TopSurface = 0
  1330. focus.BottomSurface = 0
  1331. focus.formFactor = "Plate"
  1332. focus.Size = Vector3.new(0, 0, 0)
  1333. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
  1334. cam.CameraSubject = focus
  1335. cam.CameraType = "Attach"
  1336. while zoom == true and selected == true do
  1337. local set = false
  1338. if target ~= nil then
  1339. if target.Parent ~= nil then
  1340. if target.Anchored == false then
  1341. 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)
  1342. set = true
  1343. end
  1344. end
  1345. end
  1346. if set == false then
  1347. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
  1348. end
  1349. wait()
  1350. end
  1351. if focus ~= nil then focus:Remove() focus = nil end
  1352. local cam = game:GetService("Workspace").CurrentCamera
  1353. cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
  1354. cam.CameraType = "Custom"
  1355. else
  1356. zoom = false
  1357. end
  1358. end
  1359. if key == "u" and Button1Down == false and canFire == true then
  1360. if automatic == false and burst == false then
  1361. if switchToBurst == true then
  1362. burst = true
  1363. local m = Instance.new("Message", Player)
  1364. m.Text = "Burst"
  1365. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1366. delay(2.5, function() m:Remove() end)
  1367. elseif switchToAutomatic == true then
  1368. automatic = true
  1369. local m = Instance.new("Message", Player)
  1370. m.Text = "Automatic"
  1371. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1372. delay(2.5, function() m:Remove() end)
  1373. end
  1374. elseif automatic == false and burst == true then
  1375. if switchToAutomatic == true then
  1376. automatic = true
  1377. burst = false
  1378. local m = Instance.new("Message", Player)
  1379. m.Text = "Automatic"
  1380. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1381. delay(2.5, function() m:Remove() end)
  1382. elseif switchToSingle == true then
  1383. burst = false
  1384. local m = Instance.new("Message", Player)
  1385. m.Text = "Single"
  1386. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1387. delay(2.5, function() m:Remove() end)
  1388. end
  1389. elseif automatic == true and burst == false then
  1390. if switchToSingle == true then
  1391. automatic = false
  1392. local m = Instance.new("Message", Player)
  1393. m.Text = "Single"
  1394. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1395. delay(2.5, function() m:Remove() end)
  1396. elseif switchToBurst == true then
  1397. automatic = false
  1398. burst = true
  1399. local m = Instance.new("Message", Player)
  1400. m.Text = "Burst"
  1401. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1402. delay(2.5, function() m:Remove() end)
  1403. end
  1404. end
  1405. end
  1406. end
  1407.  
  1408.  
  1409. function onSelected(mouse)
  1410. if selected == true then return end
  1411. selected = true
  1412. canFire = false
  1413. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1414. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1415. if Player.Character.WeaponActivated.Value == nil then break end
  1416. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1417. wait()
  1418. end
  1419. updateGui()
  1420. local weapon = Instance.new("ObjectValue")
  1421. weapon.Name = "WeaponActivated"
  1422. weapon.Value = script.Parent
  1423. weapon.Parent = Player.Character
  1424. DisableLimb(1, Player.Character)
  1425. DisableLimb(2, Player.Character)
  1426. ForceAngle(1, 0, Player.Character)
  1427. ForceAngle(2, 0, Player.Character)
  1428. if dual == true then
  1429. coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
  1430. playAnimation("rightEquip")
  1431. removeParts("LeftHolster")
  1432. makeParts("LeftHand")
  1433. else
  1434. playAnimation("equip")
  1435. end
  1436. removeParts("RightHolster")
  1437. makeParts("RightHand")
  1438. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  1439. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  1440. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  1441. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1442. canFire = true
  1443. end
  1444.  
  1445.  
  1446. function onDeselected(mouse)
  1447. if selected == false then return end
  1448. Button1Down = false
  1449. while canFire == false do
  1450. wait()
  1451. end
  1452. selected = false
  1453. if dual == true then
  1454. if math.random(1, 2) == 1 then
  1455. coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
  1456. wait(math.random(1, 10) / 10)
  1457. playAnimation("rightUnequip")
  1458. else
  1459. coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
  1460. wait(math.random(1, 10) / 10)
  1461. playAnimation("leftUnequip")
  1462. end
  1463. removeParts("LeftHand")
  1464. makeParts("LeftHolster")
  1465. else
  1466. playAnimation("unequip")
  1467. end
  1468. removeParts("RightHand")
  1469. makeParts("RightHolster")
  1470. ForceAngle(1, 0, Player.Character)
  1471. ForceAngle(2, 0, Player.Character)
  1472. ResetLimbCFrame(1, Player.Character)
  1473. ResetLimbCFrame(2, Player.Character)
  1474. EnableLimb(1, Player.Character)
  1475. EnableLimb(2, Player.Character)
  1476. silenced = false
  1477. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  1478. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  1479. if Player.Character.WeaponActivated.Value == script.Parent then
  1480. Player.Character.WeaponActivated:Remove()
  1481. end
  1482. end
  1483. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1484. if Player.Character.WeaponActivated.Value == nil then break end
  1485. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1486. wait()
  1487. end
  1488. end
  1489.  
  1490.  
  1491. if script.Parent.ClassName ~= "HopperBin" then
  1492. if Player == nil then print("Error: Player not found!") return end
  1493. Tool = Instance.new("HopperBin")
  1494. Tool.Name = Name
  1495. Tool.Parent = Player.Backpack
  1496. script.Name = "Main"
  1497. script.Parent = Tool
  1498. end wait() if script.Parent.ClassName == "HopperBin" then
  1499. while script.Parent.Parent.ClassName ~= "Backpack" do
  1500. wait()
  1501. end
  1502. if script.Parent:FindFirstChild("MagazineMax") == nil then
  1503. magazineMax = Instance.new("NumberValue")
  1504. magazineMax.Name = "MagazineMax"
  1505. magazineMax.Value = 1
  1506. magazineMax.Parent = script.Parent
  1507. else
  1508. magazineMax = script.Parent.MagazineMax
  1509. end
  1510. if script.Parent:FindFirstChild("Magazine") == nil then
  1511. magazine = Instance.new("NumberValue")
  1512. magazine.Name = "Magazine"
  1513. magazine.Value = 0
  1514. magazine.Parent = script.Parent
  1515. else
  1516. magazine = script.Parent.Magazine
  1517. end
  1518. if script.Parent:FindFirstChild("AmmoMax") == nil then
  1519. ammoMax = Instance.new("NumberValue")
  1520. ammoMax.Name = "AmmoMax"
  1521. ammoMax.Value = 21
  1522. ammoMax.Parent = script.Parent
  1523. else
  1524. ammoMax = script.Parent.AmmoMax
  1525. end
  1526. if script.Parent:FindFirstChild("Ammo") == nil then
  1527. ammo = Instance.new("NumberValue")
  1528. ammo.Name = "Ammo"
  1529. ammo.Value = script.Parent.AmmoMax.Value
  1530. ammo.Parent = script.Parent
  1531. else
  1532. ammo = script.Parent.Ammo
  1533. end
  1534. Player = script.Parent.Parent.Parent
  1535. makeParts("RightHolster")
  1536. script.Parent.Selected:connect(onSelected)
  1537. script.Parent.Deselected:connect(onDeselected)
  1538. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement