Advertisement
waconline

Pistol

Feb 20th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.57 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 = game.Players.LocalPlayer
  159. Name = "FN Five-seveN"
  160. selected = false
  161. canDual = true
  162. dual = false
  163. Button1Down = false
  164. damage = 100
  165. canFire = true
  166. canFire2 = false
  167. readyTime = 0.1
  168. automatic = false
  169. burst = false
  170. burstCount = 0
  171. burstCountMax = 3
  172. canSilence = true
  173. silenced = false
  174. canZoom = false
  175. zoom = false
  176. switchToSingle = false
  177. switchToBurst = false
  178. switchToAutomatic = false
  179.  
  180.  
  181. ammoGui = Instance.new("ScreenGui")
  182. ammoGui.Name = Name
  183. local frame = Instance.new("Frame")
  184. frame.Name = "Frame"
  185. frame.Size = UDim2.new(0, 165, 0, 60)
  186. frame.Position = UDim2.new(0, 0, 1, -60)
  187. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  188. frame.BorderColor3 = Color3.new(0, 0, 0)
  189. frame.Parent = ammoGui
  190. local label = Instance.new("TextLabel")
  191. label.Name = "Weapon"
  192. label.Text = "Weapon: " ..Name
  193. label.Size = UDim2.new(1, 0, 0, 20)
  194. label.Position = UDim2.new(0, 0, 0, 0)
  195. label.BackgroundColor3 = Color3.new(1, 0, 0)
  196. label.BorderColor3 = Color3.new(0, 0, 0)
  197. label.Parent = frame
  198. local label = Instance.new("TextLabel")
  199. label.Name = "MagazinePrefix"
  200. label.Text = " Magazine:"
  201. label.TextXAlignment = "Left"
  202. label.Size = UDim2.new(1, 0, 0, 20)
  203. label.Position = UDim2.new(0, 0, 0, 20)
  204. label.BackgroundColor3 = Color3.new(1, 1, 1)
  205. label.BorderColor3 = Color3.new(0, 0, 0)
  206. label.Parent = frame
  207. local label = Instance.new("TextLabel")
  208. label.Name = "Magazine"
  209. label.Text = "0/0"
  210. label.TextXAlignment = "Right"
  211. label.Size = UDim2.new(1, 0, 0, 20)
  212. label.Position = UDim2.new(0, -10, 0, 20)
  213. label.BackgroundTransparency = 1
  214. label.BorderSizePixel = 0
  215. label.Parent = frame
  216. local label = Instance.new("TextLabel")
  217. label.Name = "AmmoPrefix"
  218. label.Text = " Ammunition:"
  219. label.TextXAlignment = "Left"
  220. label.Size = UDim2.new(1, 0, 0, 20)
  221. label.Position = UDim2.new(0, 0, 0, 40)
  222. label.BackgroundColor3 = Color3.new(1, 1, 1)
  223. label.BorderColor3 = Color3.new(0, 0, 0)
  224. label.Parent = frame
  225. local label = Instance.new("TextLabel")
  226. label.Name = "Ammo"
  227. label.Text = "0/0"
  228. label.TextXAlignment = "Right"
  229. label.Size = UDim2.new(1, 0, 0, 20)
  230. label.Position = UDim2.new(0, -10, 0, 40)
  231. label.BackgroundTransparency = 1
  232. label.BorderSizePixel = 0
  233. label.Parent = frame
  234.  
  235.  
  236. function updateGui()
  237. if selected == false then return end
  238. if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
  239. if Player.PlayerGui:FindFirstChild(Name) == nil then
  240. ammoGui:Clone().Parent = Player.PlayerGui
  241. end
  242. Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
  243. Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
  244. end
  245.  
  246.  
  247. function makeParts(format)
  248. local model = Instance.new("Model")
  249. model.Name = Name
  250. local pm = Instance.new("Part")
  251. pm.Name = "Handle"
  252. pm.FormFactor = "Custom"
  253. pm.Size = Vector3.new(1, 1, 1)
  254. pm.BrickColor = BrickColor.new("Really black")
  255. pm.Locked = true
  256. pm.TopSurface = 0
  257. pm.BottomSurface = 0
  258. pm.Parent = model
  259. local m = Instance.new("SpecialMesh")
  260. m.MeshType = "Brick"
  261. m.Scale = Vector3.new(0.3, 0.9, 0.4)
  262. m.Parent = pm
  263. if format ~= nil then
  264. local w = Instance.new("Weld")
  265. w.Part0 = pm
  266. if format == "RightHand" then
  267. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  268. w.C0 = CFrame.new(0, 1.2, 0.7)
  269. w.C1 = CFrame.new()
  270. elseif format == "LeftHand" then
  271. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  272. w.C0 = CFrame.new(0, 1.2, 0.7)
  273. w.C1 = CFrame.new()
  274. model.Name = Name.. " (Left)"
  275. elseif format == "RightHolster" then
  276. w.Part1 = Player.Character:FindFirstChild("Right Leg")
  277. w.C0 = CFrame.new(-0.65, -0.25, 0) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0)
  278. w.C1 = CFrame.new()
  279. w.Parent = pm
  280. model.Name = Name.. " (Holstered)"
  281. elseif format == "LeftHolster" then
  282. w.Part1 = Player.Character:FindFirstChild("Left Leg")
  283. w.C0 = CFrame.new(0.65, -0.25, 0) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0)
  284. w.C1 = CFrame.new()
  285. model.Name = Name.. " (Holstered, Left)"
  286. end
  287. w.Parent = pm
  288. model.Parent = Player.Character
  289. end
  290. local s = Instance.new("Sound")
  291. s.Name = "Fire"
  292. s.SoundId = "http://www.roblox.com/Asset/?id=2920959"
  293. s.Volume = 1
  294. s.Pitch = 1
  295. s.Looped = false
  296. s.Parent = pm
  297. local s = Instance.new("Sound")
  298. s.Name = "Reload"
  299. s.SoundId = "http://www.roblox.com/Asset/?version=1&id=2691591"
  300. s.Volume = 1
  301. s.Pitch = 3
  302. s.Looped = false
  303. s.Parent = pm
  304. local s = Instance.new("Sound")
  305. s.Name = "Empty"
  306. s.SoundId = "http://www.roblox.com/Asset/?id=2697295"
  307. s.Volume = 1
  308. s.Pitch = 5
  309. s.Looped = false
  310. s.Parent = pm
  311. local s = Instance.new("Sound")
  312. s.Name = "Switch"
  313. s.SoundId = "http://www.roblox.com/Asset/?id=2697295"
  314. s.Volume = 1
  315. s.Pitch = 10
  316. s.Looped = false
  317. s.Parent = pm
  318. local p = Instance.new("Part")
  319. p.Name = "ShellOut"
  320. p.FormFactor = "Custom"
  321. p.Size = Vector3.new(1, 1, 1)
  322. p.Transparency = 1
  323. p.Locked = true
  324. p.CanCollide = false
  325. p.TopSurface = 0
  326. p.BottomSurface = 0
  327. p.Parent = model
  328. local w = Instance.new("Weld")
  329. w.Part0 = p
  330. w.Part1 = pm
  331. w.C0 = CFrame.new(0.5, 0, 0.5) * CFrame.fromEulerAnglesXYZ(0, math.rad(45), 0)
  332. w.C1 = CFrame.new()
  333. w.Parent = p
  334. local p = Instance.new("Part")
  335. p.Name = "Grip"
  336. p.FormFactor = "Custom"
  337. p.Size = Vector3.new(1, 1, 1)
  338. p.BrickColor = BrickColor.new("Really black")
  339. p.Locked = true
  340. p.TopSurface = 0
  341. p.BottomSurface = 0
  342. p.Parent = model
  343. local m = Instance.new("SpecialMesh")
  344. m.MeshType = "Brick"
  345. m.Scale = Vector3.new(0.3, 0.5, 0.9)
  346. m.Parent = p
  347. local w = Instance.new("Weld")
  348. w.Part0 = p
  349. w.Part1 = pm
  350. w.C0 = CFrame.new(0, -0.05, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
  351. w.C1 = CFrame.new()
  352. w.Parent = p
  353. local p = Instance.new("Part")
  354. p.Name = "Magazine"
  355. p.FormFactor = "Custom"
  356. p.Size = Vector3.new(1, 1, 1)
  357. p.BrickColor = BrickColor.new("Really black")
  358. p.Locked = true
  359. p.TopSurface = 0
  360. p.BottomSurface = 0
  361. p.Parent = model
  362. local m = Instance.new("SpecialMesh")
  363. m.MeshType = "Brick"
  364. m.Scale = Vector3.new(0.275, 0.475, 1)
  365. m.Parent = p
  366. local w = Instance.new("Weld")
  367. w.Part0 = p
  368. w.Part1 = pm
  369. w.C0 = CFrame.new(0, -0.05, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
  370. w.C1 = CFrame.new()
  371. w.Parent = p
  372. local p = Instance.new("Part")
  373. p.Name = "TriggerHousing"
  374. p.FormFactor = "Custom"
  375. p.Size = Vector3.new(1, 1, 1)
  376. p.BrickColor = BrickColor.new("Really black")
  377. p.Locked = true
  378. p.TopSurface = 0
  379. p.BottomSurface = 0
  380. p.Parent = model
  381. local m = Instance.new("SpecialMesh")
  382. m.MeshType = "Brick"
  383. m.Scale = Vector3.new(0.1, 0.2, 0.025)
  384. m.Parent = p
  385. local w = Instance.new("Weld")
  386. w.Part0 = p
  387. w.Part1 = pm
  388. w.C0 = CFrame.new(0, 0.2, -0.4)
  389. w.C1 = CFrame.new()
  390. w.Parent = p
  391. local p = Instance.new("Part")
  392. p.Name = "TriggerHousing"
  393. p.FormFactor = "Custom"
  394. p.Size = Vector3.new(1, 1, 1)
  395. p.BrickColor = BrickColor.new("Really black")
  396. p.Locked = true
  397. p.TopSurface = 0
  398. p.BottomSurface = 0
  399. p.Parent = model
  400. local m = Instance.new("SpecialMesh")
  401. m.MeshType = "Brick"
  402. m.Scale = Vector3.new(0.1, 0.2, 0.025)
  403. m.Parent = p
  404. local w = Instance.new("Weld")
  405. w.Part0 = p
  406. w.Part1 = pm
  407. w.C0 = CFrame.new(0, 0.02, -0.49) * CFrame.fromEulerAnglesXYZ(math.rad(-45), 0, 0)
  408. w.C1 = CFrame.new()
  409. w.Parent = p
  410. local p = Instance.new("Part")
  411. p.Name = "TriggerHousing"
  412. p.FormFactor = "Custom"
  413. p.Size = Vector3.new(1, 1, 1)
  414. p.BrickColor = BrickColor.new("Really black")
  415. p.Locked = true
  416. p.TopSurface = 0
  417. p.BottomSurface = 0
  418. p.Parent = model
  419. local m = Instance.new("SpecialMesh")
  420. m.MeshType = "Brick"
  421. m.Scale = Vector3.new(0.1, 0.025, 0.1)
  422. m.Parent = p
  423. local w = Instance.new("Weld")
  424. w.Part0 = p
  425. w.Part1 = pm
  426. w.C0 = CFrame.new(0, 0.426, -0.22)
  427. w.C1 = CFrame.new()
  428. w.Parent = p
  429. local p = Instance.new("Part")
  430. p.Name = "Trigger"
  431. p.FormFactor = "Custom"
  432. p.Size = Vector3.new(1, 1, 1)
  433. p.BrickColor = BrickColor.new("Really black")
  434. p.Locked = true
  435. p.TopSurface = 0
  436. p.BottomSurface = 0
  437. p.Parent = model
  438. local m = Instance.new("SpecialMesh")
  439. m.MeshType = "Brick"
  440. m.Scale = Vector3.new(0.1, 0.025, 0.15)
  441. m.Parent = p
  442. local w = Instance.new("Weld")
  443. w.Part0 = p
  444. w.Part1 = pm
  445. w.C0 = CFrame.new(0, 0.175, -0.3) * CFrame.fromEulerAnglesXYZ(math.rad(-10), 0, 0)
  446. w.C1 = CFrame.new()
  447. w.Parent = p
  448. local p = Instance.new("Part")
  449. p.Name = "Barrel"
  450. p.CanCollide = false
  451. p.FormFactor = "Custom"
  452. p.Size = Vector3.new(1, 1, 1)
  453. p.BrickColor = BrickColor.new("Really black")
  454. p.Locked = true
  455. p.TopSurface = 0
  456. p.BottomSurface = 0
  457. p.Parent = model
  458. local m = Instance.new("SpecialMesh")
  459. m.MeshType = "Brick"
  460. m.Scale = Vector3.new(0.2, 0.5, 0.35)
  461. m.Parent = p
  462. local w = Instance.new("Weld")
  463. w.Part0 = p
  464. w.Part1 = pm
  465. w.C0 = CFrame.new(0, 0.7, 0.025)
  466. w.C1 = CFrame.new()
  467. w.Parent = p
  468. local p = Instance.new("Part")
  469. p.Name = "Muzzle"
  470. p.FormFactor = "Custom"
  471. p.Size = Vector3.new(1, 1, 1)
  472. p.BrickColor = BrickColor.new("Really black")
  473. p.CanCollide = false
  474. p.Locked = true
  475. p.TopSurface = 0
  476. p.BottomSurface = 0
  477. p.Parent = model
  478. local m = Instance.new("CylinderMesh")
  479. m.Scale = Vector3.new(0.2, 0.05, 0.2)
  480. m.Parent = p
  481. local w = Instance.new("Weld")
  482. w.Part0 = p
  483. w.Part1 = pm
  484. w.C0 = CFrame.new(0, 0.95, 0.075)
  485. w.C1 = CFrame.new()
  486. w.Parent = p
  487. local s = Instance.new("Smoke")
  488. s.Enabled = false
  489. s.Name = "Smoke"
  490. s.RiseVelocity = -5
  491. s.Opacity = 0.3
  492. s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225)
  493. s.Size = 1
  494. s.Parent = p
  495. local f = Instance.new("Fire")
  496. f.Enabled = false
  497. f.Name = "Fire"
  498. f.Heat = -35
  499. f.Size = 1
  500. f.Parent = p
  501. local p = Instance.new("Part")
  502. p.Name = "Silencer"
  503. p.FormFactor = "Custom"
  504. p.Size = Vector3.new(1, 1, 1)
  505. p.BrickColor = BrickColor.new("Really black")
  506. p.CanCollide = false
  507. p.Transparency = 1
  508. p.Locked = true
  509. p.TopSurface = 0
  510. p.BottomSurface = 0
  511. p.Parent = model
  512. local m = Instance.new("CylinderMesh")
  513. m.Scale = Vector3.new(0.4, 1, 0.4)
  514. m.Parent = p
  515. local w = Instance.new("Weld")
  516. w.Part0 = p
  517. w.Part1 = pm
  518. w.C0 = CFrame.new(0, 1.475, 0.075)
  519. w.C1 = CFrame.new()
  520. w.Parent = p
  521. return model
  522. end
  523.  
  524.  
  525. function removeParts(format)
  526. if format == "RightHand" then
  527. pcall(function() Player.Character[Name]:Remove() end)
  528. elseif format == "LeftHand" then
  529. pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
  530. elseif format == "RightHolster" then
  531. pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
  532. elseif format == "LeftHolster" then
  533. pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
  534. end
  535. end
  536.  
  537.  
  538. function SetAngle(Joint, Angle, Character)
  539. if Character == nil then return false end
  540. local Joints = {
  541. Character.Torso:FindFirstChild("Right Shoulder 2"),
  542. Character.Torso:FindFirstChild("Left Shoulder 2"),
  543. Character.Torso:FindFirstChild("Right Hip 2"),
  544. Character.Torso:FindFirstChild("Left Hip 2")
  545. }
  546. if Joints[Joint] == nil then return false end
  547. if Joint == 1 or Joint == 3 then
  548. Joints[Joint].DesiredAngle = Angle
  549. end
  550. if Joint == 2 or Joint == 4 then
  551. Joints[Joint].DesiredAngle = -Angle
  552. end
  553. end
  554.  
  555.  
  556. function ForceAngle(Joint, Angle, Character)
  557. if Character == nil then return false end
  558. local Joints = {
  559. Character.Torso:FindFirstChild("Right Shoulder 2"),
  560. Character.Torso:FindFirstChild("Left Shoulder 2"),
  561. Character.Torso:FindFirstChild("Right Hip 2"),
  562. Character.Torso:FindFirstChild("Left Hip 2")
  563. }
  564. if Joints[Joint] == nil then return false end
  565. if Joint == 1 or Joint == 3 then
  566. Joints[Joint].DesiredAngle = Angle
  567. Joints[Joint].CurrentAngle = Angle
  568. end
  569. if Joint == 2 or Joint == 4 then
  570. Joints[Joint].DesiredAngle = -Angle
  571. Joints[Joint].CurrentAngle = -Angle
  572. end
  573. end
  574.  
  575.  
  576. function SetSpeed(Joint, Speed, Character)
  577. if Character == nil then return false end
  578. local Joints = {
  579. Character.Torso:FindFirstChild("Right Shoulder 2"),
  580. Character.Torso:FindFirstChild("Left Shoulder 2"),
  581. Character.Torso:FindFirstChild("Right Hip 2"),
  582. Character.Torso:FindFirstChild("Left Hip 2")
  583. }
  584. if Joints[Joint] == nil then return false end
  585. Joints[Joint].MaxVelocity = Speed
  586. end
  587.  
  588.  
  589. function DisableLimb(Limb, Character)
  590. if Character == nil then return false end
  591. if Character:FindFirstChild("Torso") == nil then return false end
  592. local Joints = {
  593. Character.Torso:FindFirstChild("Right Shoulder"),
  594. Character.Torso:FindFirstChild("Left Shoulder"),
  595. Character.Torso:FindFirstChild("Right Hip"),
  596. Character.Torso:FindFirstChild("Left Hip")
  597. }
  598. local Limbs = {
  599. Character:FindFirstChild("Right Arm"),
  600. Character:FindFirstChild("Left Arm"),
  601. Character:FindFirstChild("Right Leg"),
  602. Character:FindFirstChild("Left Leg")
  603. }
  604. if Joints[Limb] == nil then return false end
  605. if Limbs[Limb] == nil then return false end
  606. local Joint = Instance.new("Motor")
  607. Joint.Parent = Character.Torso
  608. Joint.Part0 = Character.Torso
  609. Joint.Part1 = Limbs[Limb]
  610. if Limb == 1 then
  611. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  612. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  613. Joint.Name = "Right Shoulder 2"
  614. elseif Limb == 2 then
  615. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  616. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  617. Joint.Name = "Left Shoulder 2"
  618. elseif Limb == 3 then
  619. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  620. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  621. Joint.Name = "Right Hip 2"
  622. elseif Limb == 4 then
  623. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  624. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  625. Joint.Name = "Left Hip 2"
  626. end
  627. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  628. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  629. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  630. Joints[Limb]:Remove()
  631. end
  632.  
  633.  
  634. function ResetLimbCFrame(Limb, Character)
  635. if Character == nil then return false end
  636. if Character.Parent == nil then return false end
  637. if Character:FindFirstChild("Torso") == nil then return false end
  638. local Joints = {
  639. Character.Torso:FindFirstChild("Right Shoulder 2"),
  640. Character.Torso:FindFirstChild("Left Shoulder 2"),
  641. Character.Torso:FindFirstChild("Right Hip 2"),
  642. Character.Torso:FindFirstChild("Left Hip 2")
  643. }
  644. local Limbs = {
  645. Character:FindFirstChild("Right Arm"),
  646. Character:FindFirstChild("Left Arm"),
  647. Character:FindFirstChild("Right Leg"),
  648. Character:FindFirstChild("Left Leg")
  649. }
  650. if Joints[Limb] == nil then return false end
  651. if Limbs[Limb] == nil then return false end
  652. if Limb == 1 then
  653. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  654. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  655. elseif Limb == 2 then
  656. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  657. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  658. elseif Limb == 3 then
  659. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  660. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  661. elseif Limb == 4 then
  662. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  663. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  664. end
  665. end
  666.  
  667.  
  668. function EnableLimb(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 2"),
  673. Character.Torso:FindFirstChild("Left Shoulder 2"),
  674. Character.Torso:FindFirstChild("Right Hip 2"),
  675. Character.Torso:FindFirstChild("Left Hip 2")
  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. if Limb == 1 then
  686. Joints[Limb].Name = "Right Shoulder"
  687. elseif Limb == 2 then
  688. Joints[Limb].Name = "Left Shoulder"
  689. elseif Limb == 3 then
  690. Joints[Limb].Name = "Right Hip"
  691. elseif Limb == 4 then
  692. Joints[Limb].Name = "Left Hip"
  693. end
  694. Animate = Character:FindFirstChild("Animate")
  695. if Animate == nil then return false end
  696. Animate = Animate:Clone()
  697. Character.Animate:Remove()
  698. Animate.Parent = Character
  699. end
  700.  
  701.  
  702. function playAnimation(format, mouse)
  703. if format == "equip" then
  704. Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove()
  705. local w = Instance.new("Weld")
  706. w.Part0 = Player.Character[Name.. " (Holstered)"].Handle
  707. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  708. w.C0 = CFrame.new(0, 1.2, 0.7)
  709. w.C1 = CFrame.new()
  710. w.Parent = Player.Character[Name.. " (Holstered)"].Handle
  711. for i = 0.01, 1, 0.1 do
  712. if Player.Character:FindFirstChild("Torso") ~= nil then
  713. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  714. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  715. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.55 * i) + (1.5 * (1 - i)), 0.75 * i, 0.35 * i) * CFrame.fromEulerAnglesXYZ(math.rad(315 + ((1 - i) * 50)), 0, math.rad(-90) * i)
  716. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  717. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  718. wait()
  719. else return false end
  720. else return false end
  721. end
  722. return playAnimation("hold")
  723. end
  724. if format == "rightEquip" then
  725. Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove()
  726. local w = Instance.new("Weld")
  727. w.Part0 = Player.Character[Name.. " (Holstered)"].Handle
  728. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  729. w.C0 = CFrame.new(0, 1.2, 0.7)
  730. w.C1 = CFrame.new()
  731. w.Parent = Player.Character[Name.. " (Holstered)"].Handle
  732. for i = 0.01, 1, 0.1 do
  733. if Player.Character:FindFirstChild("Torso") ~= nil then
  734. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  735. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  736. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  737. wait()
  738. else return false end
  739. else return false end
  740. end
  741. return playAnimation("rightHold")
  742. end
  743. if format == "leftEquip" then
  744. Player.Character[Name.. " (Holstered, Left)"].Handle.Weld:Remove()
  745. local w = Instance.new("Weld")
  746. w.Part0 = Player.Character[Name.. " (Holstered, Left)"].Handle
  747. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  748. w.C0 = CFrame.new(0, 1.2, 0.7)
  749. w.C1 = CFrame.new()
  750. w.Parent = Player.Character[Name.. " (Holstered, Left)"].Handle
  751. for i = 0.01, 1, 0.1 do
  752. if Player.Character:FindFirstChild("Torso") ~= nil then
  753. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
  754. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  755. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((1 * i) + (1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(5 * i), 0)
  756. wait()
  757. else return false end
  758. else return false end
  759. end
  760. return playAnimation("leftHold")
  761. end
  762. if format == "unequip" then
  763. for i = 1, 0.01, -0.1 do
  764. if Player.Character:FindFirstChild("Torso") ~= nil then
  765. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  766. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  767. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.55 * i) + (1.5 * (1 - i)), 0.75 * i, 0.35 * i) * CFrame.fromEulerAnglesXYZ(math.rad(315 + ((1 - i) * 50)), 0, math.rad(-90) * i)
  768. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  769. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  770. wait()
  771. else return false end
  772. else return false end
  773. end
  774. return true
  775. end
  776. if format == "leftUnequip" then
  777. for i = 1, 0.01, -0.1 do
  778. if Player.Character:FindFirstChild("Torso") ~= nil then
  779. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
  780. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  781. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((1 * i) + (1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(5 * i), 0)
  782. wait()
  783. else return false end
  784. else return false end
  785. end
  786. return true
  787. end
  788. if format == "rightUnequip" then
  789. for i = 1, 0.01, -0.1 do
  790. if Player.Character:FindFirstChild("Torso") ~= nil then
  791. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  792. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  793. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  794. wait()
  795. else return false end
  796. else return false end
  797. end
  798. return true
  799. end
  800. if format == "hold" then
  801. if Player.Character:FindFirstChild("Torso") ~= nil then
  802. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  803. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  804. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), 0, math.rad(-90))
  805. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  806. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  807. else return false end
  808. else return false end
  809. end
  810. if format == "rightHold" then
  811. if Player.Character:FindFirstChild("Torso") ~= nil then
  812. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  813. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  814. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  815. else return false end
  816. else return false end
  817. end
  818. if format == "leftHold" then
  819. if Player.Character:FindFirstChild("Torso") ~= nil then
  820. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
  821. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  822. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(5), 0)
  823. else return false end
  824. else return false end
  825. end
  826. if format == "reload" then
  827. Player.Character[Name].Handle.Reload:Play()
  828. for i = 0, 25, 5 do
  829. if Player.Character:FindFirstChild("Torso") ~= nil then
  830. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  831. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  832. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55 + (i / 50), 0.75 - (i / 50), 0.35 + (i / 22.5)) * CFrame.fromEulerAnglesXYZ(math.rad(315 - (i * 2)), math.rad(-i * 3.5), math.rad(-90))
  833. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  834. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * 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].Magazine.Transparency = 1
  840. local magazineDrop = Player.Character[Name].Magazine:Clone()
  841. magazineDrop.Transparency = 0
  842. magazineDrop.Parent = Workspace
  843. 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)
  844. delay(0.1, function() magazineDrop.CanCollide = true end)
  845. local magazineNew = Player.Character[Name].Magazine:Clone()
  846. magazineNew.Name = "New Magazine"
  847. magazineNew.Transparency = 0
  848. magazineNew.Parent = Player.Character[Name]
  849. local w = Instance.new("Weld")
  850. w.Part0 = magazineNew
  851. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  852. w.C0 = CFrame.new(0, 1.1, 0)
  853. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  854. w.Parent = magazineNew
  855. for i = 25, 0, -5 do
  856. if Player.Character:FindFirstChild("Torso") ~= nil then
  857. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  858. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  859. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55 + (i / 50), 0.75 - (i / 50), 0.35 + (i / 22.5)) * CFrame.fromEulerAnglesXYZ(math.rad(315 - (i * 2)), math.rad(-i * 3.5), math.rad(-90))
  860. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  861. 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)))
  862. wait()
  863. else return false end
  864. else return false end
  865. end
  866. Player.Character[Name].Magazine.Transparency = 0
  867. Player.Character[Name]["New Magazine"]:Remove()
  868. for i = 25, 0, -5 do
  869. if Player.Character:FindFirstChild("Torso") ~= nil then
  870. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  871. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  872. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1 + (i / 30), 0.5, 0.6 + (i / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), math.rad((25 * 2) - ((25 - i) * 2)))
  873. wait()
  874. else return false end
  875. else return false end
  876. end
  877. wait(0.04)
  878. for i = 0, 5, 1 do
  879. if Player.Character:FindFirstChild("Torso") ~= nil then
  880. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  881. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  882. 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))
  883. wait()
  884. else return false end
  885. else return false end
  886. end
  887. for i = 5, 0, -1 do
  888. if Player.Character:FindFirstChild("Torso") ~= nil then
  889. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  890. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  891. 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))
  892. wait()
  893. else return false end
  894. else return false end
  895. end
  896. end
  897. if format == "reloadDual" then
  898. Player.Character[Name].Handle.Reload:Play()
  899. Player.Character[Name].Magazine.Transparency = 1
  900. Player.Character[Name.. " (Left)"].Magazine.Transparency = 1
  901. local magazineDrop = Player.Character[Name].Magazine:Clone()
  902. magazineDrop.Transparency = 0
  903. magazineDrop.Parent = Workspace
  904. 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)
  905. delay(0.1, function() magazineDrop.CanCollide = true end)
  906. local magazineDropDual = Player.Character[Name.. " (Left)"].Magazine:Clone()
  907. magazineDropDual.Transparency = 0
  908. magazineDropDual.Parent = Workspace
  909. coroutine.resume(coroutine.create(function(part) wait(4.5) for i = 0, 1, 0.1 do part.Transparency = i wait() end part:Remove() end), magazineDropDual)
  910. delay(0.1, function() magazineDropDual.CanCollide = true end)
  911. for i = 0, 25, 7.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(1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0)
  916. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  917. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * 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 = 125, 0, -15 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(1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(5), 0)
  927. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  928. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(-5), 0)
  929. wait()
  930. else return false end
  931. else return false end
  932. end
  933. Player.Character[Name].Magazine.Transparency = 0
  934. Player.Character[Name.. " (Left)"].Magazine.Transparency = 0
  935. for i = 0, 125, 15 do
  936. if Player.Character:FindFirstChild("Torso") ~= nil then
  937. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  938. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  939. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(5), 0)
  940. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  941. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(-5), 0)
  942. wait()
  943. else return false end
  944. else return false end
  945. end
  946. for i = 25, 0, -5 do
  947. if Player.Character:FindFirstChild("Torso") ~= nil then
  948. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  949. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  950. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0)
  951. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  952. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  953. wait()
  954. else return false end
  955. else return false end
  956. end
  957. end
  958. if format == "fire" then
  959. makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
  960. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  961. if silenced then
  962. Player.Character[Name].Handle.Fire.Volume = math.random(3, 8) / 10
  963. Player.Character[Name].Handle.Fire.Pitch = math.random(20, 25) / 10
  964. Player.Character[Name].Handle.Fire:Play()
  965. CamShake(5, 50000)
  966. else
  967. Player.Character[Name].Handle.Fire.Volume = math.random(8, 12) / 10
  968. Player.Character[Name].Handle.Fire.Pitch = math.random(8, 12) / 10
  969. Player.Character[Name].Handle.Fire:Play()
  970. CamShake(10, 25000)
  971. end
  972. else return false end
  973. if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  974. 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))
  975. else return false end
  976. for i = 0, 10, 5 do
  977. if Player.Character:FindFirstChild("Torso") ~= nil then
  978. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  979. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  980. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), math.rad(i), math.rad(-90))
  981. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  982. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  983. wait()
  984. else return false end
  985. else return false end
  986. end
  987. for i = 10, 0, -5 do
  988. if Player.Character:FindFirstChild("Torso") ~= nil then
  989. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  990. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  991. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), math.rad(i), math.rad(-90))
  992. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  993. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  994. wait()
  995. else return false end
  996. else return false end
  997. end
  998. end
  999. if format == "rightFire" then
  1000. makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
  1001. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  1002. if silenced then
  1003. Player.Character[Name].Handle.Fire.Volume = math.random(3, 8) / 10
  1004. Player.Character[Name].Handle.Fire.Pitch = math.random(20, 25) / 10
  1005. Player.Character[Name].Handle.Fire:Play()
  1006. CamShake(5, 50000)
  1007. else
  1008. Player.Character[Name].Handle.Fire.Volume = math.random(8, 12) / 10
  1009. Player.Character[Name].Handle.Fire.Pitch = math.random(8, 12) / 10
  1010. Player.Character[Name].Handle.Fire:Play()
  1011. CamShake(10, 25000)
  1012. end
  1013. else return false end
  1014. if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  1015. 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))
  1016. else return false end
  1017. for i = 0, 10, 5 do
  1018. if Player.Character:FindFirstChild("Torso") ~= nil then
  1019. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1020. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1021. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1022. wait()
  1023. else return false end
  1024. else return false end
  1025. end
  1026. for i = 10, 0, -5 do
  1027. if Player.Character:FindFirstChild("Torso") ~= nil then
  1028. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1029. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1030. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1031. wait()
  1032. else return false end
  1033. else return false end
  1034. end
  1035. end
  1036. if format == "leftFire" then
  1037. makeShell(Player.Character[Name.. " (Left)"]:FindFirstChild("ShellOut"))
  1038. if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") ~= nil then
  1039. if silenced then
  1040. Player.Character[Name.. " (Left)"].Handle.Fire.Volume = math.random(3, 8) / 10
  1041. Player.Character[Name.. " (Left)"].Handle.Fire.Pitch = math.random(20, 25) / 10
  1042. Player.Character[Name.. " (Left)"].Handle.Fire:Play()
  1043. CamShake(5, 50000)
  1044. else
  1045. Player.Character[Name.. " (Left)"].Handle.Fire.Volume = math.random(8, 12) / 10
  1046. Player.Character[Name.. " (Left)"].Handle.Fire.Pitch = math.random(8, 12) / 10
  1047. Player.Character[Name.. " (Left)"].Handle.Fire:Play()
  1048. CamShake(10, 25000)
  1049. end
  1050. end
  1051. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") ~= nil then
  1052. coroutine.resume(coroutine.create(function() Player.Character[Name.. " (Left)"].Muzzle.Smoke.Enabled = true Player.Character[Name.. " (Left)"].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name.. " (Left)"].Muzzle.Smoke.Enabled = false Player.Character[Name.. " (Left)"].Muzzle.Fire.Enabled = false end))
  1053. end
  1054. for i = 0, 10, 5 do
  1055. if Player.Character:FindFirstChild("Torso") ~= nil then
  1056. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1057. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1058. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0)
  1059. wait()
  1060. else return false end
  1061. else return false end
  1062. end
  1063. for i = 10, 0, -5 do
  1064. if Player.Character:FindFirstChild("Torso") ~= nil then
  1065. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1066. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1067. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0)
  1068. wait()
  1069. else return false end
  1070. else return false end
  1071. end
  1072. end
  1073. return true
  1074. end
  1075.  
  1076.  
  1077. function CamShake(time, freq)
  1078. coroutine.resume(coroutine.create(function()
  1079. local cam = Workspace.CurrentCamera
  1080. local time = 10
  1081. local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
  1082. if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
  1083. if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
  1084. 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)
  1085. for i = 1, time do
  1086. 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)
  1087. wait()
  1088. end
  1089. end))
  1090. end
  1091.  
  1092.  
  1093. function makeShell(part)
  1094. if part == nil then return false end
  1095. local casing = Instance.new("Part")
  1096. casing.Name = "Shell"
  1097. casing.FormFactor = "Custom"
  1098. casing.Size = Vector3.new(1, 1, 1)
  1099. 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)))
  1100. casing.BrickColor = BrickColor.new("New Yeller")
  1101. local mesh = Instance.new("CylinderMesh")
  1102. mesh.Scale = Vector3.new(0.1, 0.3, 0.1)
  1103. mesh.Parent = casing
  1104. casing.Parent = Workspace
  1105. casing:BreakJoints()
  1106. casing.Velocity = (part.CFrame.lookVector * 50) + Vector3.new(0, 10, 0)
  1107. coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end))
  1108. end
  1109.  
  1110.  
  1111. function Weld(x, y)
  1112. local weld = Instance.new("Weld")
  1113. weld.Part0 = x
  1114. weld.Part1 = y
  1115. CJ = CFrame.new(x.Position)
  1116. C0 = x.CFrame:inverse() * CJ
  1117. C1 = y.CFrame:inverse() * CJ
  1118. weld.C0 = C0
  1119. weld.C1 = C1
  1120. weld.Parent = x
  1121. end
  1122.  
  1123.  
  1124. function tagHumanoid(humanoid)
  1125. local tag = Instance.new("ObjectValue")
  1126. tag.Name = "creator"
  1127. tag.Value = Player
  1128. tag.Parent = humanoid
  1129. local tag = Instance.new("StringValue")
  1130. tag.Name = "creatorType1"
  1131. tag.Value = Name
  1132. tag.Parent = humanoid
  1133. local tag = Instance.new("StringValue")
  1134. tag.Name = "creatorType2"
  1135. tag.Value = "shot"
  1136. tag.Parent = humanoid
  1137. end
  1138.  
  1139.  
  1140. function untagHumanoid(humanoid)
  1141. if humanoid ~= nil then
  1142. local tag = humanoid:FindFirstChild("creator")
  1143. if tag ~= nil then
  1144. tag:Remove()
  1145. end
  1146. local tag = humanoid:FindFirstChild("creatorType1")
  1147. if tag ~= nil then
  1148. tag:Remove()
  1149. end
  1150. local tag = humanoid:FindFirstChild("creatorType2")
  1151. if tag ~= nil then
  1152. tag:Remove()
  1153. end
  1154. end
  1155. end
  1156.  
  1157.  
  1158. function fire(startPoint, endPoint, hit)
  1159. local trail = Instance.new("Part")
  1160. trail.Name = "Bullet Trail"
  1161. trail.BrickColor = BrickColor.new("New Yeller")
  1162. trail.TopSurface = 0
  1163. trail.BottomSurface = 0
  1164. trail.FormFactor = 0
  1165. trail.Size = Vector3.new(1, 1, 1)
  1166. trail.Transparency = 0.3
  1167. trail.Anchored = true
  1168. trail.CanCollide = false
  1169. trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint)
  1170. trail.Parent = Workspace
  1171. local mesh = Instance.new("SpecialMesh")
  1172. mesh.MeshType = "Brick"
  1173. mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - endPoint).magnitude)
  1174. mesh.Parent = trail
  1175. 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)
  1176. if hit ~= nil then
  1177. if hit.Parent == nil then return end
  1178. if hit.Parent:FindFirstChild("Humanoid") ~= nil then
  1179. tagHumanoid(hit.Parent.Humanoid)
  1180. if hit.Name == "Head" then
  1181. hit.Parent.Humanoid:TakeDamage(damage * 10)
  1182. elseif hit.Name == "Torso" then
  1183. hit.Parent.Humanoid:TakeDamage(damage * 2)
  1184. else
  1185. hit.Parent.Humanoid:TakeDamage(damage)
  1186. end
  1187. if math.random(1, 10) == 1 then
  1188. hit.Parent.Humanoid.Sit = true
  1189. end
  1190. delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end)
  1191. end
  1192. if hit.Anchored == false then
  1193. hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 2))
  1194. end
  1195. end
  1196. end
  1197.  
  1198.  
  1199. function onButton1Down(mouse)
  1200. if selected == false then return end
  1201. 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
  1202. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  1203. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1204. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
  1205. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
  1206. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1207. Button1Down = true
  1208. canFire = false
  1209. canFire2 = true
  1210. while canFire2 == true do
  1211. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1212. if humanoid == nil then
  1213. canFire2 = false
  1214. break
  1215. end
  1216. if humanoid.Health <= 0 then
  1217. canFire2 = false
  1218. break
  1219. end
  1220. local fireLeft = false
  1221. if automatic == false and burst == false then
  1222. canFire2 = false
  1223. elseif automatic == false and burst == true then
  1224. if burstCount >= burstCountMax then
  1225. canFire2 = false
  1226. burstCount = 0
  1227. break
  1228. end
  1229. burstCount = burstCount + 1
  1230. elseif automatic == true and burst == false then
  1231. fireLeft = true
  1232. end
  1233. if magazine.Value > 0 then
  1234. magazine.Value = magazine.Value - 1
  1235. updateGui()
  1236. fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1237. coroutine.resume(coroutine.create(function()
  1238. if dual == true then
  1239. playAnimation("rightFire")
  1240. elseif dual == false then
  1241. playAnimation("fire")
  1242. end
  1243. end))
  1244. else
  1245. Player.Character[Name].Handle.Empty:Play()
  1246. end
  1247. if fireLeft == true and dual == true and automatic == true then
  1248. if magazine.Value > 0 then
  1249. coroutine.resume(coroutine.create(function()
  1250. wait(readyTime / 2)
  1251. magazine.Value = magazine.Value - 1
  1252. updateGui()
  1253. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1254. playAnimation("leftFire")
  1255. end))
  1256. else
  1257. coroutine.resume(coroutine.create(function()
  1258. wait(readyTime / 2)
  1259. Player.Character[Name].Handle.Empty:Play()
  1260. end))
  1261. end
  1262. end
  1263. wait(readyTime)
  1264. end
  1265. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1266. canFire = true
  1267. end
  1268. end
  1269.  
  1270.  
  1271. function onButton1Up(mouse)
  1272. if selected == false then return end
  1273. Button1Down = false
  1274. canFire2 = false
  1275. burstCount = 0
  1276. while canFire == false do wait() end
  1277. if dual == true and automatic == false then
  1278. if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
  1279. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1280. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1281. canFire = false
  1282. canFire2 = true
  1283. while canFire2 == true do
  1284. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1285. if humanoid == nil then
  1286. canFire2 = false
  1287. break
  1288. end
  1289. if humanoid.Health <= 0 then
  1290. canFire2 = false
  1291. break
  1292. end
  1293. if burst == false then
  1294. canFire2 = false
  1295. elseif burst == true then
  1296. if burstCount >= burstCountMax then
  1297. canFire2 = false
  1298. burstCount = 0
  1299. break
  1300. end
  1301. burstCount = burstCount + 1
  1302. end
  1303. if magazine.Value <= 0 then
  1304. Player.Character[Name].Handle.Empty:Play()
  1305. else
  1306. coroutine.resume(coroutine.create(function()
  1307. playAnimation("leftFire")
  1308. end))
  1309. magazine.Value = magazine.Value - 1
  1310. updateGui()
  1311. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1312. end
  1313. wait(readyTime)
  1314. end
  1315. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1316. canFire = true
  1317. end
  1318. end
  1319.  
  1320.  
  1321. function onKeyDown(key, mouse)
  1322. if selected == false then return end
  1323. key = key:lower()
  1324. if key == "q" and Button1Down == false and canFire == true then
  1325. if mouse.Target == nil then return end
  1326. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  1327. if dual == true then onKeyDown("t", mouse) end
  1328. onDeselected(mouse)
  1329. removeParts("RightHolster")
  1330. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  1331. end
  1332. end
  1333. if key == "e" and Button1Down == false and canFire == true and canSilence == true then
  1334. if silenced then
  1335. silenced = false
  1336. if Player.Character:FindFirstChild(Name) == nil then return end
  1337. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1338. if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
  1339. Player.Character[Name].Muzzle.Transparency = 1
  1340. Player.Character[Name].Muzzle.Name = "Silencer"
  1341. Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
  1342. if dual == true then
  1343. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1344. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
  1345. Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
  1346. Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
  1347. Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
  1348. end
  1349. else
  1350. silenced = true
  1351. if Player.Character:FindFirstChild(Name) == nil then return end
  1352. if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
  1353. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1354. Player.Character[Name].Silencer.Transparency = 0
  1355. Player.Character[Name].Muzzle.Name = "Muzzle 2"
  1356. Player.Character[Name].Silencer.Name = "Muzzle"
  1357. if dual == true then
  1358. if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
  1359. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1360. Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
  1361. Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
  1362. Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
  1363. end
  1364. end
  1365. end
  1366. if key == "r" and Button1Down == false and canFire == true then
  1367. if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then
  1368. canFire = false
  1369. burstCount = 0
  1370. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1371. if magazine.Value > 0 then ammo.Value = ammo.Value + magazine.Value magazine.Value = 0 end
  1372. updateGui()
  1373. if dual == true then
  1374. playAnimation("reloadDual")
  1375. elseif dual == false then
  1376. playAnimation("reload")
  1377. end
  1378. if ammo.Value - magazineMax.Value < 0 then
  1379. magazine.Value = ammo.Value
  1380. ammo.Value = 0
  1381. elseif ammo.Value - magazineMax.Value >= 0 then
  1382. ammo.Value = ammo.Value - magazineMax.Value
  1383. magazine.Value = magazineMax.Value
  1384. end
  1385. updateGui()
  1386. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1387. canFire = true
  1388. end
  1389. end
  1390. if key == "t" and Button1Down == false and canFire == true and canDual == true then
  1391. canFire = false
  1392. if dual == false then
  1393. local weapon = nil
  1394. for _, p in pairs(Player.Backpack:GetChildren()) do
  1395. if p.Name == Name and p ~= script.Parent then weapon = p break end
  1396. end
  1397. if weapon ~= nil then
  1398. dual = true
  1399. weapon.Name = "Dual"
  1400. weapon.Parent = script
  1401. silenced = false
  1402. removeParts("RightHand")
  1403. makeParts("RightHand")
  1404. removeParts("RightHolster")
  1405. makeParts("LeftHolster")
  1406. playAnimation("leftEquip")
  1407. removeParts("LeftHolster")
  1408. makeParts("LeftHand")
  1409. magazineMax.Value = math.ceil(magazineMax.Value * 2)
  1410. ammoMax.Value = math.ceil(ammoMax.Value * 2)
  1411. magazine.Value = magazine.Value + weapon.Magazine.Value
  1412. ammo.Value = ammo.Value + weapon.Ammo.Value
  1413. updateGui()
  1414. end
  1415. elseif dual == true then
  1416. local weapon = script:FindFirstChild("Dual")
  1417. if weapon ~= nil then
  1418. dual = false
  1419. weapon.Name = Name
  1420. weapon.Parent = Player.Backpack
  1421. silenced = false
  1422. removeParts("RightHand")
  1423. makeParts("RightHand")
  1424. playAnimation("leftUnequip")
  1425. removeParts("LeftHand")
  1426. makeParts("RightHolster")
  1427. playAnimation("hold")
  1428. weapon.Magazine.Value = math.floor(magazine.Value / 2)
  1429. weapon.Ammo.Value = math.floor(ammo.Value / 2)
  1430. magazineMax.Value = math.ceil(magazineMax.Value / 2)
  1431. ammoMax.Value = math.ceil(ammoMax.Value / 2)
  1432. magazine.Value = math.ceil(magazine.Value / 2)
  1433. ammo.Value = math.ceil(ammo.Value / 2)
  1434. updateGui()
  1435. end
  1436. end
  1437. canFire = true
  1438. end
  1439. if key == "y" and canZoom == true then
  1440. if zoom == false then
  1441. zoom = true
  1442. local pos = mouse.Hit.p
  1443. local target = mouse.Target
  1444. local cam = Workspace.CurrentCamera
  1445. focus = Instance.new("Part", Workspace)
  1446. focus.Anchored = true
  1447. focus.CanCollide = false
  1448. focus.Transparency = 1
  1449. focus.TopSurface = 0
  1450. focus.BottomSurface = 0
  1451. focus.FormFactor = "Plate"
  1452. focus.Size = Vector3.new(0, 0, 0)
  1453. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p)
  1454. cam.CameraSubject = focus
  1455. cam.CameraType = "Attach"
  1456. while zoom == true and selected == true do
  1457. local set = false
  1458. if target ~= nil then
  1459. if target.Parent ~= nil then
  1460. if target.Anchored == false then
  1461. focus.CFrame = CFrame.new(target.Position) * (CFrame.new(Player.Character.Torso.Position, target.Position) - CFrame.new(Player.Character.Torso.Position, target.Position).p)
  1462. set = true
  1463. end
  1464. end
  1465. end
  1466. if set == false then
  1467. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.Position, pos) - CFrame.new(Player.Character.Torso.Position, pos).p)
  1468. end
  1469. wait()
  1470. end
  1471. if focus ~= nil then focus:Remove() focus = nil end
  1472. local cam = Workspace.CurrentCamera
  1473. cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
  1474. cam.CameraType = "Custom"
  1475. else
  1476. zoom = false
  1477. end
  1478. end
  1479. if key == "u" and Button1Down == false and canFire == true then
  1480. if automatic == false and burst == false then
  1481. if switchToBurst == true then
  1482. burst = true
  1483. local m = Instance.new("Message", Player)
  1484. m.Text = "Burst"
  1485. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1486. delay(2.5, function() m:Remove() end)
  1487. elseif switchToAutomatic == true then
  1488. automatic = true
  1489. local m = Instance.new("Message", Player)
  1490. m.Text = "Automatic"
  1491. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1492. delay(2.5, function() m:Remove() end)
  1493. end
  1494. elseif automatic == false and burst == true then
  1495. if switchToAutomatic == true then
  1496. automatic = true
  1497. burst = false
  1498. local m = Instance.new("Message", Player)
  1499. m.Text = "Automatic"
  1500. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1501. delay(2.5, function() m:Remove() end)
  1502. elseif switchToSingle == true then
  1503. burst = false
  1504. local m = Instance.new("Message", Player)
  1505. m.Text = "Single"
  1506. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1507. delay(2.5, function() m:Remove() end)
  1508. end
  1509. elseif automatic == true and burst == false then
  1510. if switchToSingle == true then
  1511. automatic = false
  1512. local m = Instance.new("Message", Player)
  1513. m.Text = "Single"
  1514. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1515. delay(2.5, function() m:Remove() end)
  1516. elseif switchToBurst == true then
  1517. automatic = false
  1518. burst = true
  1519. local m = Instance.new("Message", Player)
  1520. m.Text = "Burst"
  1521. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1522. delay(2.5, function() m:Remove() end)
  1523. end
  1524. end
  1525. end
  1526. end
  1527.  
  1528.  
  1529. function onSelected(mouse)
  1530. if selected == true then return end
  1531. selected = true
  1532. canFire = false
  1533. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  1534. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1535. if Player.Character.WeaponActivated.Value == nil then break end
  1536. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1537. wait()
  1538. end
  1539. updateGui()
  1540. local weapon = Instance.new("ObjectValue")
  1541. weapon.Name = "WeaponActivated"
  1542. weapon.Value = script.Parent
  1543. weapon.Parent = Player.Character
  1544. DisableLimb(1, Player.Character)
  1545. DisableLimb(2, Player.Character)
  1546. ForceAngle(1, 0, Player.Character)
  1547. ForceAngle(2, 0, Player.Character)
  1548. if dual == true then
  1549. coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
  1550. playAnimation("rightEquip")
  1551. removeParts("LeftHolster")
  1552. makeParts("LeftHand")
  1553. else
  1554. playAnimation("equip")
  1555. end
  1556. removeParts("RightHolster")
  1557. makeParts("RightHand")
  1558. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  1559. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  1560. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  1561. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  1562. canFire = true
  1563. end
  1564.  
  1565.  
  1566. function onDeselected(mouse)
  1567. if selected == false then return end
  1568. Button1Down = false
  1569. while canFire == false do
  1570. wait()
  1571. end
  1572. selected = false
  1573. if dual == true then
  1574. if math.random(1, 2) == 1 then
  1575. coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
  1576. wait(math.random(1, 10) / 10)
  1577. playAnimation("rightUnequip")
  1578. else
  1579. coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
  1580. wait(math.random(1, 10) / 10)
  1581. playAnimation("leftUnequip")
  1582. end
  1583. removeParts("LeftHand")
  1584. makeParts("LeftHolster")
  1585. else
  1586. playAnimation("unequip")
  1587. end
  1588. removeParts("RightHand")
  1589. makeParts("RightHolster")
  1590. ForceAngle(1, 0, Player.Character)
  1591. ForceAngle(2, 0, Player.Character)
  1592. ResetLimbCFrame(1, Player.Character)
  1593. ResetLimbCFrame(2, Player.Character)
  1594. EnableLimb(1, Player.Character)
  1595. EnableLimb(2, Player.Character)
  1596. silenced = false
  1597. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  1598. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  1599. if Player.Character.WeaponActivated.Value == script.Parent then
  1600. Player.Character.WeaponActivated:Remove()
  1601. end
  1602. end
  1603. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1604. if Player.Character.WeaponActivated.Value == nil then break end
  1605. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1606. wait()
  1607. end
  1608. end
  1609.  
  1610.  
  1611. if script.Parent.ClassName ~= "HopperBin" then
  1612. if Player == nil then print("Error: Player not found!") return end
  1613. Tool = Instance.new("HopperBin")
  1614. Tool.Name = Name
  1615. Tool.Parent = Player.Backpack
  1616. script.Name = "Main"
  1617. script.Parent = Tool
  1618. end wait() if script.Parent.ClassName == "HopperBin" then
  1619. while script.Parent.Parent.ClassName ~= "Backpack" do
  1620. wait()
  1621. end
  1622. if script.Parent:FindFirstChild("MagazineMax") == nil then
  1623. magazineMax = Instance.new("NumberValue")
  1624. magazineMax.Name = "MagazineMax"
  1625. magazineMax.Value = 10
  1626. magazineMax.Parent = script.Parent
  1627. else
  1628. magazineMax = script.Parent.MagazineMax
  1629. end
  1630. if script.Parent:FindFirstChild("Magazine") == nil then
  1631. magazine = Instance.new("NumberValue")
  1632. magazine.Name = "Magazine"
  1633. magazine.Value = 0
  1634. magazine.Parent = script.Parent
  1635. else
  1636. magazine = script.Parent.Magazine
  1637. end
  1638. if script.Parent:FindFirstChild("AmmoMax") == nil then
  1639. ammoMax = Instance.new("NumberValue")
  1640. ammoMax.Name = "AmmoMax"
  1641. ammoMax.Value = 260
  1642. ammoMax.Parent = script.Parent
  1643. else
  1644. ammoMax = script.Parent.AmmoMax
  1645. end
  1646. if script.Parent:FindFirstChild("Ammo") == nil then
  1647. ammo = Instance.new("NumberValue")
  1648. ammo.Name = "Ammo"
  1649. ammo.Value = script.Parent.AmmoMax.Value
  1650. ammo.Parent = script.Parent
  1651. else
  1652. ammo = script.Parent.Ammo
  1653. end
  1654. Player = script.Parent.Parent.Parent
  1655. makeParts("RightHolster")
  1656. script.Parent.Selected:connect(onSelected)
  1657. script.Parent.Deselected:connect(onDeselected)
  1658. end
  1659.  
  1660. --mediafire
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement