Advertisement
-----------------

guns reupload

May 11th, 2021
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 137.58 KB | None | 0 0
  1. --Converted with ttyyuu12345's model to script plugin v4
  2. function sandbox(var,func)
  3. local env = getfenv(func)
  4. local newenv = setmetatable({},{
  5. __index = function(self,k)
  6. if k=="script" then
  7. return var
  8. else
  9. return env[k]
  10. end
  11. end,
  12. })
  13. setfenv(func,newenv)
  14. return func
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. Script0 = Instance.new("Script")
  19. Script1 = Instance.new("Script")
  20. Script2 = Instance.new("Script")
  21. Script3 = Instance.new("Script")
  22. Script0.Name = "ak47"
  23. Script0.Parent = mas
  24. table.insert(cors,sandbox(Script0,function()
  25. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  26. local Player,game,owner = owner,game
  27. local RealPlayer = Player
  28. do
  29. --print("FE Compatibility code V2 by Mokiros")
  30. local RealPlayer = RealPlayer
  31. script.Parent = RealPlayer.Character
  32.  
  33. --Fake event to make stuff like Mouse.KeyDown work
  34. local Disconnect_Function = function(this)
  35. this[1].Functions[this[2]] = nil
  36. end
  37. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  38. local FakeEvent_Metatable = {__index={
  39. Connect = function(this,f)
  40. local i = tostring(math.random(0,10000))
  41. while this.Functions[i] do
  42. i = tostring(math.random(0,10000))
  43. end
  44. this.Functions[i] = f
  45. return setmetatable({this,i},Disconnect_Metatable)
  46. end
  47. }}
  48. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  49. local function fakeEvent()
  50. return setmetatable({Functions={}},FakeEvent_Metatable)
  51. end
  52.  
  53. --Creating fake input objects with fake variables
  54. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  55. FakeMouse.keyUp = FakeMouse.KeyUp
  56. FakeMouse.keyDown = FakeMouse.KeyDown
  57. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  58. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  59. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  60. end}
  61. --Merged 2 functions into one by checking amount of arguments
  62. CAS.UnbindAction = CAS.BindAction
  63.  
  64. --This function will trigger the events that have been :Connect()'ed
  65. local function TriggerEvent(self,ev,...)
  66. for _,f in pairs(self[ev].Functions) do
  67. f(...)
  68. end
  69. end
  70. FakeMouse.TriggerEvent = TriggerEvent
  71. UIS.TriggerEvent = TriggerEvent
  72.  
  73. --Client communication
  74. local Event = Instance.new("RemoteEvent")
  75. Event.Name = "UserInput_Event"
  76. Event.OnServerEvent:Connect(function(plr,io)
  77. if plr~=RealPlayer then return end
  78. FakeMouse.Target = io.Target
  79. FakeMouse.Hit = io.Hit
  80. if not io.isMouse then
  81. local b = io.UserInputState == Enum.UserInputState.Begin
  82. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  83. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  84. end
  85. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  86. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  87. end
  88. for _,t in pairs(CAS.Actions) do
  89. for _,k in pairs(t.Keys) do
  90. if k==io.KeyCode then
  91. t.Function(t.Name,io.UserInputState,io)
  92. end
  93. end
  94. end
  95. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  96. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  97. end
  98. end)
  99. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  100. local Mouse = owner:GetMouse()
  101. local UIS = game:GetService("UserInputService")
  102. local input = function(io,RobloxHandled)
  103. if RobloxHandled then return end
  104. --Since InputObject is a client-side instance, we create and pass table instead
  105. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  106. end
  107. UIS.InputBegan:Connect(input)
  108. UIS.InputEnded:Connect(input)
  109. local h,t
  110. --Give the server mouse data every second frame, but only if the values changed
  111. --If player is not moving their mouse, client won't fire events
  112. local HB = game:GetService("RunService").Heartbeat
  113. while true do
  114. if h~=Mouse.Hit or t~=Mouse.Target then
  115. h,t=Mouse.Hit,Mouse.Target
  116. Event:FireServer({isMouse=true,Target=t,Hit=h})
  117. end
  118. --Wait 2 frames
  119. for i=1,2 do
  120. HB:Wait()
  121. end
  122. end]==],script)
  123.  
  124. ----Sandboxed game object that allows the usage of client-side methods and services
  125. --Real game object
  126. local RealGame = game
  127.  
  128. --Metatable for fake service
  129. local FakeService_Metatable = {
  130. __index = function(self,k)
  131. local s = rawget(self,"_RealService")
  132. if s then
  133. return typeof(s[k])=="function"
  134. and function(_,...)return s[k](s,...)end or s[k]
  135. end
  136. end,
  137. __newindex = function(self,k,v)
  138. local s = rawget(self,"_RealService")
  139. if s then s[k]=v end
  140. end
  141. }
  142. local function FakeService(t,RealService)
  143. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  144. return setmetatable(t,FakeService_Metatable)
  145. end
  146.  
  147. --Fake game object
  148. local FakeGame = {
  149. GetService = function(self,s)
  150. return rawget(self,s) or RealGame:GetService(s)
  151. end,
  152. Players = FakeService({
  153. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  154. },"Players"),
  155. UserInputService = FakeService(UIS,"UserInputService"),
  156. ContextActionService = FakeService(CAS,"ContextActionService"),
  157. RunService = FakeService({
  158. _btrs = {},
  159. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  160. BindToRenderStep = function(self,name,_,fun)
  161. self._btrs[name] = self.Heartbeat:Connect(fun)
  162. end,
  163. UnbindFromRenderStep = function(self,name)
  164. self._btrs[name]:Disconnect()
  165. end,
  166. },"RunService")
  167. }
  168. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  169. FakeGame.service = FakeGame.GetService
  170. FakeService(FakeGame,game)
  171. --Changing owner to fake player object to support owner:GetMouse()
  172. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  173. end
  174.  
  175. --//====================================================\\--
  176. --|| CREATED BY BRANNON1964802
  177. --\\====================================================//--
  178.  
  179.  
  180.  
  181. wait(1 / 60)
  182.  
  183.  
  184.  
  185. Player = game:GetService("Players").LocalPlayer
  186. PlayerGui = Player.PlayerGui
  187. Cam = workspace.CurrentCamera
  188. Backpack = Player.Backpack
  189. Character = Player.Character
  190. Humanoid = Character.Humanoid
  191. Mouse = Player:GetMouse()
  192. RootPart = Character["HumanoidRootPart"]
  193. Torso = Character["Torso"]
  194. Head = Character["Head"]
  195. Face = Head.face
  196. RightArm = Character["Right Arm"]
  197. LeftArm = Character["Left Arm"]
  198. RightLeg = Character["Right Leg"]
  199. LeftLeg = Character["Left Leg"]
  200. RootJoint = RootPart["RootJoint"]
  201. Neck = Torso["Neck"]
  202. RightShoulder = Torso["Right Shoulder"]
  203. LeftShoulder = Torso["Left Shoulder"]
  204. RightHip = Torso["Right Hip"]
  205. LeftHip = Torso["Left Hip"]
  206.  
  207. IT = Instance.new
  208. CF = CFrame.new
  209. VT = Vector3.new
  210. RAD = math.rad
  211. C3 = Color3.new
  212. UD2 = UDim2.new
  213. BRICKC = BrickColor.new
  214. ANGLES = CFrame.Angles
  215. EULER = CFrame.fromEulerAnglesXYZ
  216. COS = math.cos
  217. ACOS = math.acos
  218. SIN = math.sin
  219. ASIN = math.asin
  220. ABS = math.abs
  221. ATAN = math.atan
  222. SIGN = math.sign
  223. FREXP = math.frexp
  224. MRANDOM = math.random
  225. FLOOR = math.floor
  226. MHUGE = math.huge
  227. NUMSEQ = NumberSequence.new
  228. NUMSEQKEYP = NumberSequenceKeypoint.new
  229. NUMRANGE = NumberRange.new
  230. COLORSEQ = ColorSequence.new
  231. COLORSEQKEYP = ColorSequenceKeypoint.new
  232.  
  233.  
  234.  
  235.  
  236.  
  237. --//=================================\\
  238. --|| USEFUL VALUES
  239. --\\=================================//
  240.  
  241. local EQUIPPED = false
  242. local GUNSTANCE = false
  243. local MOUSEDOWN = false
  244. local SMOKETIME = 0
  245. local GUNHANDLEOFFSET = nil
  246. local MAXBULLETS = 30
  247. local BULLETCOUNT = MAXBULLETS
  248. local BulletShellImpactSounds = {"1684805263", "1684805499", "1684805682", "1684805848", "1684806019", "1684806165", "1684806345", "1684806545"}
  249. local BulletImpactSounds = {"525719118", "525719147", "525719186", "525719232", "525719348", "525719399", "525719421", "525720445", "525720464", "525720500", "525720527", "525720556", "525720625", "525720650"}
  250. local gunshots = {"2290994834","2290995643","2290994062","2291001802"}
  251.  
  252.  
  253.  
  254.  
  255. --//=================================\\
  256. --||SOME FUNCTIONS AND WEAPON CREATION
  257. --\\=================================//
  258.  
  259. local WeaponFolder = IT("Folder")
  260. WeaponFolder.Name = "Weapon"
  261. local EffectsFolder = workspace--[[IT("Folder")
  262. EffectsFolder.Name = "Effects"
  263. EffectsFolder.Parent = WeaponFolder--]]
  264.  
  265. local GunHandlePart = IT("Part")
  266. GunHandlePart.Anchored = false
  267. GunHandlePart.FormFactor = "Custom"
  268. GunHandlePart.TopSurface, GunHandlePart.BottomSurface, GunHandlePart.RightSurface, GunHandlePart.LeftSurface, GunHandlePart.FrontSurface, GunHandlePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  269. GunHandlePart.Name = "Gun Handle Part"
  270. GunHandlePart.Material = "Plastic"
  271. GunHandlePart.Reflectance = 0
  272. GunHandlePart.Transparency = 0
  273. GunHandlePart.CanCollide = false
  274. GunHandlePart.Locked = true
  275. GunHandlePart.BrickColor = BRICKC("Black")
  276. GunHandlePart.Position = Torso.Position
  277. GunHandlePart.Size = VT(0.2, 0.2, 0.2)
  278. GunHandlePart:BreakJoints()
  279. GunHandlePart.Parent = WeaponFolder
  280.  
  281. local GunHandleMesh = IT("SpecialMesh")
  282. GunHandleMesh.MeshType = "FileMesh"
  283. GunHandleMesh.MeshId = "rbxassetid://3824749"
  284. GunHandleMesh.TextureId = ""
  285. GunHandleMesh.Offset = VT(0, 0.15, -0.6)
  286. GunHandleMesh.Scale = VT(1.5, 1.5, 1.5)
  287. GunHandleMesh.Parent = GunHandlePart
  288.  
  289. local GunHandleMotor = IT("Motor")
  290. GunHandleMotor.C0 = CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
  291. GunHandleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  292. GunHandleMotor.Part0 = Torso
  293. GunHandleMotor.Part1 = GunHandlePart
  294. GunHandleMotor.Parent = GunHandlePart
  295.  
  296. local GunHolePart = IT("Part")
  297. GunHolePart.Anchored = false
  298. GunHolePart.FormFactor = "Custom"
  299. GunHolePart.TopSurface, GunHolePart.BottomSurface, GunHolePart.RightSurface, GunHolePart.LeftSurface, GunHolePart.FrontSurface, GunHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  300. GunHolePart.Name = "Gun Hole Part"
  301. GunHolePart.Material = "Plastic"
  302. GunHolePart.Reflectance = 0
  303. GunHolePart.Transparency = 1
  304. GunHolePart.CanCollide = false
  305. GunHolePart.Locked = true
  306. GunHolePart.BrickColor = BRICKC("Medium stone grey")
  307. GunHolePart.Position = Torso.Position
  308. GunHolePart.Size = VT(0, 0, 0)
  309. GunHolePart:BreakJoints()
  310. GunHolePart.Parent = WeaponFolder
  311.  
  312. local GunHoleMotor = IT("Motor")
  313. GunHoleMotor.C0 = CF(0, 0.6, -3.35) * ANGLES(RAD(0), RAD(0), RAD(0))
  314. GunHoleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  315. GunHoleMotor.Part0 = GunHandlePart
  316. GunHoleMotor.Part1 = GunHolePart
  317. GunHoleMotor.Parent = GunHandlePart
  318.  
  319. local GunShot = IT("Sound")
  320. GunShot.Looped = false
  321. GunShot.Volume = 1
  322. GunShot.Pitch = 1
  323. GunShot.SoundId = "rbxassetid://10209859" --10209798, 2920959, 10209859
  324. GunShot.Parent = GunHolePart
  325.  
  326. -- 273794772 = Gun Holster/Unholster
  327.  
  328. local GunUnholster = IT("Sound")
  329. GunUnholster.Looped = false
  330. GunUnholster.Volume = 1
  331. GunUnholster.Pitch = 1
  332. GunUnholster.SoundId = "rbxassetid://204223703" --609342351
  333. GunUnholster.Parent = GunHandlePart
  334.  
  335. local GunHolster = IT("Sound")
  336. GunHolster.Looped = false
  337. GunHolster.Volume = 1
  338. GunHolster.Pitch = 1
  339. GunHolster.SoundId = "rbxassetid://204223703" --656142612, 1567552075, 202243557, 342864661, 204223703, 1244559077
  340. GunHolster.Parent = GunHandlePart
  341.  
  342. local GunReload = IT("Sound")
  343. GunReload.Looped = false
  344. GunReload.Volume = 1
  345. GunReload.Pitch = 1
  346. GunReload.SoundId = "rbxassetid://10209869" --10209801, 2920960, 10209869, 2691591
  347. GunReload.Parent = GunHandlePart
  348.  
  349. local GunChamberBack = IT("Sound")
  350. GunChamberBack.Looped = false
  351. GunChamberBack.Volume = 1
  352. GunChamberBack.Pitch = 1.2
  353. GunChamberBack.SoundId = "rbxassetid://363762296" --299287260 short version, 268377170 longer version
  354. GunChamberBack.Parent = GunHandlePart
  355.  
  356. local GunChamberForward = IT("Sound")
  357. GunChamberForward.Looped = false
  358. GunChamberForward.Volume = 1
  359. GunChamberForward.Pitch = 1.2
  360. GunChamberForward.SoundId = "rbxassetid://364490777"
  361. GunChamberForward.Parent = GunHandlePart
  362.  
  363. local GunSmoke = IT("ParticleEmitter")
  364. GunSmoke.Enabled = false
  365. GunSmoke.Texture = "rbxassetid://528256032"
  366. GunSmoke.Size = NUMSEQ(
  367. {
  368. NUMSEQKEYP(
  369. 0, 0.1, 0.05
  370. ),
  371. NUMSEQKEYP(
  372. 1, 0.1, 0.05
  373. )
  374. }
  375. )
  376. GunSmoke.Transparency = NUMSEQ(
  377. {
  378. NUMSEQKEYP(
  379. 0, 0.9, 0
  380. ),
  381. NUMSEQKEYP(
  382. 1, 1, 0
  383. )
  384. }
  385. )
  386. GunSmoke.Color = COLORSEQ(
  387. {
  388. COLORSEQKEYP(
  389. 0, C3(255 / 255, 255 / 255, 255 / 255)
  390. ),
  391. COLORSEQKEYP(
  392. 1, C3(255 / 255, 255 / 255, 255 / 255)
  393. )
  394. }
  395. )
  396. GunSmoke.VelocitySpread = 360
  397. GunSmoke.Lifetime = NUMRANGE(1, 1)
  398. GunSmoke.Speed = NUMRANGE(0.5, 0.5)
  399. GunSmoke.Acceleration = VT(0, 2 * 5, 0)
  400. GunSmoke.Drag = 10
  401. GunSmoke.VelocityInheritance = 1
  402. GunSmoke.Rate = 1000
  403. GunSmoke.LightInfluence = 1
  404. GunSmoke.LightEmission = 0
  405. GunSmoke.ZOffset = 0.1
  406. GunSmoke.EmissionDirection = "Top"
  407. GunSmoke.Rotation = NUMRANGE(-360, 360)
  408. GunSmoke.RotSpeed = NUMRANGE(-10, 10)
  409. GunSmoke.LockedToPart = false
  410. GunSmoke.Parent = GunHolePart
  411.  
  412. local GunShotEffect = IT("ParticleEmitter")
  413. GunShotEffect.Enabled = false
  414. GunShotEffect.Texture = "rbxassetid://243728166"
  415. GunShotEffect.Size = NUMSEQ(
  416. {
  417. NUMSEQKEYP(
  418. 0, 1, 0
  419. ),
  420. NUMSEQKEYP(
  421. 1, 1, 0
  422. )
  423. }
  424. )
  425. GunShotEffect.Transparency = NUMSEQ(
  426. {
  427. NUMSEQKEYP(
  428. 0, 0
  429. ),
  430. NUMSEQKEYP(
  431. 1, 1
  432. )
  433. }
  434. )
  435. GunShotEffect.Color = COLORSEQ(
  436. {
  437. COLORSEQKEYP(
  438. 0, C3(255 / 255, 170 / 255, 128 / 255)
  439. ),
  440. COLORSEQKEYP(
  441. 1, C3(255 / 255, 170 / 255, 128 / 255)
  442. )
  443. }
  444. )
  445. GunShotEffect.VelocitySpread = 0
  446. GunShotEffect.Lifetime = NUMRANGE(0.06, 0.06)
  447. GunShotEffect.Speed = NUMRANGE(0, 0)
  448. GunShotEffect.Acceleration = VT(0, 0, 0)
  449. GunShotEffect.Drag = 0
  450. GunShotEffect.VelocityInheritance = 0
  451. GunShotEffect.Rate = 0
  452. GunShotEffect.LightInfluence = 0
  453. GunShotEffect.LightEmission = 1
  454. GunShotEffect.ZOffset = 0.1
  455. GunShotEffect.EmissionDirection = "Top"
  456. GunShotEffect.Rotation = NUMRANGE(-360, 360)
  457. GunShotEffect.RotSpeed = NUMRANGE(0, 0)
  458. GunShotEffect.LockedToPart = true
  459. GunShotEffect.Parent = GunHolePart
  460.  
  461. local GunLight = IT("PointLight")
  462. GunLight.Enabled = true
  463. GunLight.Brightness = 1000
  464. GunLight.Color = C3(255 / 255, 170 / 255, 128 / 255)
  465. GunLight.Shadows = true
  466. GunLight.Range = 0
  467. GunLight.Parent = GunHolePart
  468.  
  469. local FakeRightShoulder = IT("Weld")
  470. FakeRightShoulder.Name = "Right Shoulder"
  471. FakeRightShoulder.Part0 = Torso
  472. FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  473. FakeRightShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  474. FakeRightShoulder.Part1 = RightArm
  475.  
  476. local FakeLeftShoulder = IT("Weld")
  477. FakeLeftShoulder.Name = "Right Shoulder"
  478. FakeLeftShoulder.Part0 = Torso
  479. FakeLeftShoulder.C0 = CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  480. FakeLeftShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  481. FakeLeftShoulder.Part1 = LeftArm
  482.  
  483. WeaponFolder.Parent = Character
  484.  
  485. local function Clerp(INSTANCE, COORDINATE, TIME)
  486. return INSTANCE:lerp(COORDINATE, TIME)
  487. end
  488.  
  489. local function RenderWait(TIME)
  490. if TIME == nil or TIME == 0 then
  491. game:GetService("RunService").Heartbeat:wait()
  492. else
  493. for i = 1, TIME do
  494. game:GetService("RunService").Heartbeat:wait()
  495. end
  496. end
  497. end
  498.  
  499. local function EquipState(CURRENTSTATE)
  500. GUNSTANCE = true
  501. if CURRENTSTATE == true then
  502. RightShoulder.Parent = nil
  503. LeftShoulder.Parent = nil
  504. FakeRightShoulder.Parent = Torso
  505. FakeLeftShoulder.Parent = Torso
  506. for i = 0, 1, 0.05 do
  507. RenderWait()
  508. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
  509. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
  510. end
  511. GUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
  512. GunHandleMotor.Part0 = RightArm
  513. GunHandleMotor.C0 = GUNHANDLEOFFSET
  514. Spawn(function()
  515. RenderWait()
  516. GunUnholster:Play()
  517. end)
  518. for i = 0, 1, 0.05 do
  519. RenderWait()
  520. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.6, 0) * ANGLES(RAD(-45 + 90 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
  521. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.6, 0) * ANGLES(RAD(35 + 10 * i), RAD(0), RAD(-35 - 10 * i)) * ANGLES(RAD(0), RAD(35 + 10 * i), RAD(0)), i)
  522. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
  523. end
  524. for i = 0, 1, 0.05 do
  525. RenderWait()
  526. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.5) * ANGLES(RAD(110 - 20 * i), RAD(0), RAD(0 - 30 * i)), i)
  527. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(89 + 1 * i), RAD(0)), i)
  528. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0 - 30 * i), RAD(0)), i)
  529. end
  530. for i = 0, 1, 0.05 do
  531. RenderWait()
  532. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.5) * ANGLES(RAD(80 + 10 * i), RAD(0), RAD(-30)), i)
  533. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(89 + 1 * i), RAD(0)), i)
  534. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  535. end
  536. FakeRightShoulder.C0 = CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30))
  537. FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
  538. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
  539. else
  540. for i = 0, 1, 0.05 do
  541. RenderWait()
  542. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(45 - 90 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
  543. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(45 - 10 * i), RAD(0), RAD(-45 + 10 * i)) * ANGLES(RAD(0), RAD(45 - 10 * i), RAD(0)), i)
  544. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
  545. end
  546. Spawn(function()
  547. RenderWait()
  548. GunHolster:Play()
  549. end)
  550. for i = 0, 1, 0.05 do
  551. RenderWait()
  552. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
  553. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
  554. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, GUNHANDLEOFFSET, i)
  555. end
  556. GUNHANDLEOFFSET = Torso.CFrame:toObjectSpace(GunHandlePart.CFrame)
  557. GunHandleMotor.Part0 = Torso
  558. GunHandleMotor.C0 = GUNHANDLEOFFSET
  559. for i = 0, 1, 0.05 do
  560. RenderWait()
  561. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(1 - 1 * i), RAD(0)), i)
  562. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
  563. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0)), i)
  564. end
  565. FakeRightShoulder.Parent = nil
  566. FakeLeftShoulder.Parent = nil
  567. RightShoulder.Parent = Torso
  568. LeftShoulder.Parent = Torso
  569. GunHandleMotor.C0 = CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
  570. end
  571. GUNSTANCE = false
  572. end
  573.  
  574. local function BulletHole(POSITION, EFFECTCOLOR)
  575. local BulletHolePart = IT("Part")
  576. BulletHolePart.Anchored = true
  577. BulletHolePart.FormFactor = "Custom"
  578. BulletHolePart.TopSurface, BulletHolePart.BottomSurface, BulletHolePart.RightSurface, BulletHolePart.LeftSurface, BulletHolePart.FrontSurface, BulletHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  579. BulletHolePart.Name = "Bullet Hole"
  580. BulletHolePart.Material = "Plastic"
  581. BulletHolePart.Reflectance = 0
  582. BulletHolePart.Transparency = 1
  583. BulletHolePart.CanCollide = false
  584. BulletHolePart.Locked = true
  585. BulletHolePart.BrickColor = BRICKC("Medium stone grey")
  586. BulletHolePart.Size = VT(0.2, 0, 0.2)
  587. BulletHolePart:BreakJoints()
  588. BulletHolePart.CFrame = POSITION
  589. BulletHolePart.Parent = EffectsFolder
  590. game:GetService("Debris"):AddItem(BulletHolePart, 3)
  591. local Success, BulletHoleDecal = pcall(
  592. function()
  593. local BulletHoleDecal = IT("Decal")
  594. BulletHoleDecal.Color3 = C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  595. BulletHoleDecal.Face = "Top"
  596. BulletHoleDecal.Texture = "rbxassetid://359667865"
  597. BulletHoleDecal.Transparency = 0
  598. BulletHoleDecal.Parent = BulletHolePart
  599. return BulletHoleDecal
  600. end
  601. )
  602. local Success2, BulletHoleSound = pcall(
  603. function()
  604. local BulletHoleSound = IT("Sound")
  605. BulletHoleSound.Looped = false
  606. BulletHoleSound.Volume = 1
  607. BulletHoleSound.Pitch = MRANDOM(80, 120) / 100
  608. BulletHoleSound.SoundId = "rbxassetid://"..BulletImpactSounds[13]
  609. BulletHoleSound.Parent = BulletHolePart
  610. return BulletHoleSound
  611. end
  612. )
  613. local Success3, BulletHoleSound2 = pcall(
  614. function()
  615. local BulletHoleSound2 = IT("Sound")
  616. BulletHoleSound2.Looped = false
  617. BulletHoleSound2.Volume = 1
  618. BulletHoleSound2.Pitch = MRANDOM(80, 120) / 100
  619. BulletHoleSound2.SoundId = "rbxassetid://196864064"
  620. BulletHoleSound2.Parent = BulletHolePart
  621. return BulletHoleSound2
  622. end
  623. )
  624. local Success4, BulletImpactEffect = pcall(
  625. function()
  626. local BulletImpactEffect = IT("ParticleEmitter")
  627. BulletImpactEffect.Enabled = false
  628. BulletImpactEffect.Texture = "rbxassetid://241685484"
  629. BulletImpactEffect.Size = NUMSEQ(
  630. {
  631. NUMSEQKEYP(
  632. 0, 0.05, 0.025
  633. ),
  634. NUMSEQKEYP(
  635. 1, 0.05, 0.025
  636. )
  637. }
  638. )
  639. BulletImpactEffect.Transparency = NUMSEQ(
  640. {
  641. NUMSEQKEYP(
  642. 0, 0, 0
  643. ),
  644. NUMSEQKEYP(
  645. 1, 1, 0
  646. )
  647. }
  648. )
  649. BulletImpactEffect.Color = COLORSEQ(
  650. {
  651. COLORSEQKEYP(
  652. 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  653. ),
  654. COLORSEQKEYP(
  655. 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
  656. )
  657. }
  658. )
  659. BulletImpactEffect.VelocitySpread = 45
  660. BulletImpactEffect.Lifetime = NUMRANGE(0.2, 0.2)
  661. BulletImpactEffect.Speed = NUMRANGE(30, 30)
  662. BulletImpactEffect.Acceleration = VT(0, -196.2, 0)
  663. BulletImpactEffect.Drag = 0
  664. BulletImpactEffect.VelocityInheritance = 0
  665. BulletImpactEffect.Rate = 0
  666. BulletImpactEffect.LightInfluence = 1
  667. BulletImpactEffect.LightEmission = 0
  668. BulletImpactEffect.ZOffset = 0
  669. BulletImpactEffect.EmissionDirection = "Top"
  670. BulletImpactEffect.Rotation = NUMRANGE(-360, 360)
  671. BulletImpactEffect.RotSpeed = NUMRANGE(-360, 360)
  672. BulletImpactEffect.LockedToPart = false
  673. BulletImpactEffect.Parent = BulletHolePart
  674. return BulletImpactEffect
  675. end
  676. )
  677. local Success5, BulletImpactEffect2 = pcall(
  678. function()
  679. local BulletImpactEffect2 = IT("ParticleEmitter")
  680. BulletImpactEffect2.Enabled = false
  681. BulletImpactEffect2.Texture = "rbxassetid://709137722"
  682. BulletImpactEffect2.Size = NUMSEQ(
  683. {
  684. NUMSEQKEYP(
  685. 0, 0.5, 0
  686. ),
  687. NUMSEQKEYP(
  688. 1, 0.5, 0
  689. )
  690. }
  691. )
  692. BulletImpactEffect2.Transparency = NUMSEQ(
  693. {
  694. NUMSEQKEYP(
  695. 0, 0, 0
  696. ),
  697. NUMSEQKEYP(
  698. 1, 1, 0
  699. )
  700. }
  701. )
  702. BulletImpactEffect2.Color = COLORSEQ(
  703. {
  704. COLORSEQKEYP(
  705. 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  706. ),
  707. COLORSEQKEYP(
  708. 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
  709. )
  710. }
  711. )
  712. BulletImpactEffect2.VelocitySpread = 10
  713. BulletImpactEffect2.Lifetime = NUMRANGE(0.2, 0.2)
  714. BulletImpactEffect2.Speed = NUMRANGE(2, 2)
  715. BulletImpactEffect2.Acceleration = VT(0, 0, 0)
  716. BulletImpactEffect2.Drag = 0
  717. BulletImpactEffect2.VelocityInheritance = 0
  718. BulletImpactEffect2.Rate = 0
  719. BulletImpactEffect2.LightInfluence = 1
  720. BulletImpactEffect2.LightEmission = 0
  721. BulletImpactEffect2.ZOffset = 0.4
  722. BulletImpactEffect2.EmissionDirection = "Top"
  723. BulletImpactEffect2.Rotation = NUMRANGE(-360, 360)
  724. BulletImpactEffect2.RotSpeed = NUMRANGE(-360, 360)
  725. BulletImpactEffect2.LockedToPart = false
  726. BulletImpactEffect2.Parent = BulletHolePart
  727. return BulletImpactEffect2
  728. end
  729. )
  730. if Success or Success2 or Success3 or Success4 then
  731. Spawn(function()
  732. RenderWait()
  733. if Success4 then
  734. BulletImpactEffect:Emit(MRANDOM(5, 15))
  735. end
  736. if Success5 then
  737. BulletImpactEffect2:Emit(MRANDOM(1, 1))
  738. end
  739. if Success2 then
  740. BulletHoleSound:Play()
  741. end
  742. if Success3 then
  743. BulletHoleSound2:Play()
  744. end
  745. end)
  746. end
  747. end
  748.  
  749. local function FakeBullet(POSITION, VELOCITY)
  750. local FakeBulletPart = IT("Part")
  751. FakeBulletPart.Anchored = false
  752. FakeBulletPart.FormFactor = "Custom"
  753. FakeBulletPart.TopSurface, FakeBulletPart.BottomSurface, FakeBulletPart.RightSurface, FakeBulletPart.LeftSurface, FakeBulletPart.FrontSurface, FakeBulletPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  754. FakeBulletPart.Name = "Bullet Shell"
  755. FakeBulletPart.Material = "Plastic"
  756. FakeBulletPart.Reflectance = 0
  757. FakeBulletPart.Transparency = 0
  758. FakeBulletPart.CanCollide = true
  759. FakeBulletPart.Locked = true
  760. FakeBulletPart.BrickColor = BRICKC("Bright yellow")
  761. FakeBulletPart.Size = VT(0.22, 0.12, 0.12)
  762. FakeBulletPart:BreakJoints()
  763. FakeBulletPart.CFrame = POSITION
  764. local FakeBulletMesh = IT("SpecialMesh")
  765. FakeBulletMesh.MeshType = "Cylinder"
  766. FakeBulletMesh.MeshId = ""
  767. FakeBulletMesh.TextureId = ""
  768. FakeBulletMesh.Offset = VT(0, 0, 0)
  769. FakeBulletMesh.Scale = VT(1, 1, 1)
  770. FakeBulletMesh.Parent = FakeBulletPart
  771. FakeBulletPart.Parent = EffectsFolder
  772. FakeBulletPart.Velocity = VELOCITY
  773. game:GetService("Debris"):AddItem(FakeBulletPart, 3)
  774. local Success, BulletContact = pcall(
  775. function()
  776. local BulletContact = IT("Sound")
  777. BulletContact.Looped = false
  778. BulletContact.Volume = 0.5
  779. BulletContact.Pitch = 1
  780. BulletContact.SoundId = "rbxassetid://"..BulletShellImpactSounds[5]
  781. BulletContact.Parent = FakeBulletPart
  782. return BulletContact
  783. end
  784. )
  785. if Success then
  786. local HITSOMETHING = false
  787. FakeBulletPart.Touched:connect(
  788. function()
  789. if HITSOMETHING == false then
  790. HITSOMETHING = true
  791. Spawn(
  792. function()
  793. RenderWait()
  794. BulletContact:Play()
  795. end
  796. )
  797. end
  798. end
  799. )
  800. end
  801. end
  802.  
  803. local function FakeClip(POSITION, VELOCITY)
  804. local FakeClipPart = IT("Part")
  805. FakeClipPart.Anchored = false
  806. FakeClipPart.FormFactor = "Custom"
  807. FakeClipPart.TopSurface, FakeClipPart.BottomSurface, FakeClipPart.RightSurface, FakeClipPart.LeftSurface, FakeClipPart.FrontSurface, FakeClipPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  808. FakeClipPart.Name = "Clip"
  809. FakeClipPart.Material = "Plastic"
  810. FakeClipPart.Reflectance = 0
  811. FakeClipPart.Transparency = 0
  812. FakeClipPart.CanCollide = true
  813. FakeClipPart.Locked = true
  814. FakeClipPart.BrickColor = BRICKC("Black")
  815. FakeClipPart.Size = VT(0.08, 0.8, 0.3)
  816. FakeClipPart:BreakJoints()
  817. FakeClipPart.CFrame = POSITION
  818. FakeClipPart.Parent = EffectsFolder
  819. FakeClipPart.Velocity = VELOCITY
  820. game:GetService("Debris"):AddItem(FakeClipPart, 3)
  821. end
  822.  
  823. local function ShootGun()
  824. GUNSTANCE = true
  825. local HITHUMANOID = nil
  826. Spawn(function()
  827. RenderWait()
  828. GunShot.Pitch = MRANDOM(90, 110) / 100
  829. GunShot:Play()
  830. if (BULLETCOUNT - 1) < 0 then
  831. GunChamberBack:Play()
  832. end
  833. end)
  834. GunShotEffect:Emit(MRANDOM(4, 6))
  835. GunLight.Range = 8
  836. FakeBullet(GunHandlePart.CFrame * CF(0, 0.75, -0.6) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20))), (GunHandlePart.CFrame * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(30), RAD(0), RAD(0))).lookVector * 20)
  837. BULLETCOUNT = BULLETCOUNT - 1
  838. local GUNSPREAD = VT(MRANDOM(-300, 300) / 100, MRANDOM(-300, 300) / 100, MRANDOM(-300, 300) / 100) * ((GunHolePart.Position - Mouse.Hit.p).magnitude / 100)
  839. local GUNRAYHIT, GUNRAYPOSITION, GUNRAYANGLE = game:GetService("Workspace").FindPartOnRay(game:GetService("Workspace"), Ray.new(GunHolePart.Position, (CF(GunHolePart.Position, Mouse.Hit.p + GUNSPREAD).lookVector).unit * 1000), Character)
  840. if GUNRAYHIT ~= nil then
  841. if GUNRAYHIT.Parent:FindFirstChild("Humanoid") then
  842. HITHUMANOID = GUNRAYHIT.Parent:FindFirstChild("Humanoid")
  843. else
  844. if GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid") then
  845. HITHUMANOID = GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid")
  846. end
  847. end
  848. if HITHUMANOID ~= nil and HITHUMANOID.Parent ~= Character then
  849. HITHUMANOID.Health = HITHUMANOID.Health - (HITHUMANOID.MaxHealth * (math.random(3,4)/10))
  850. else
  851. if not (GUNRAYHIT.Name == "Bullet Hole") then
  852. BulletHole(CF(GUNRAYPOSITION, GUNRAYPOSITION - GUNRAYANGLE) * ANGLES(RAD(90), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(MRANDOM(-360, 360)), RAD(0)), GUNRAYHIT.BrickColor)
  853. end
  854. end
  855. end
  856. SMOKETIME = 2
  857. for i = 0, 1, 0.35 do
  858. RenderWait()
  859. GunLight.Range = 8 - (8 * i)
  860. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.6) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  861. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.4) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  862. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  863. end
  864. GunLight.Range = 0
  865. for i = 0, 1, 0.35 do
  866. RenderWait()
  867. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  868. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  869. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  870. end
  871. FakeRightShoulder.C0 = CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30))
  872. FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
  873. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
  874. GUNSTANCE = false
  875. end
  876.  
  877. local function ReloadGun()
  878. GUNSTANCE = true
  879. for i = 0, 1, 0.05 do
  880. RenderWait()
  881. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  882. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-5 + 10 * i), RAD(0), RAD(0)) * CF(-0.7, 0.5, -1) * ANGLES(RAD(90), RAD(0), RAD(70)) * ANGLES(RAD(0), RAD(0 - 10 * i), RAD(0)), i)
  883. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  884. end
  885. Spawn(function()
  886. RenderWait()
  887. GunReload:Play()
  888. end)
  889. FakeClip(GunHandlePart.CFrame * CF(0, 0, -0.67) * ANGLES(RAD(30), RAD(0), RAD(0)), (GunHandlePart.CFrame * ANGLES(RAD(-90), RAD(0), RAD(0))).lookVector * 10)
  890. for i = 0, 1, 0.05 do
  891. RenderWait()
  892. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(0 - 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  893. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)), i)
  894. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  895. end
  896. for i = 0, 1, 0.05 do
  897. RenderWait()
  898. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  899. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-5 + 10 * i), RAD(0), RAD(0)) * CF(-0.7, 0.5, -1) * ANGLES(RAD(90), RAD(0), RAD(70)) * ANGLES(RAD(0), RAD(0 - 10 * i), RAD(0)), i)
  900. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  901. end
  902. for i = 0, 1, 0.05 do
  903. RenderWait()
  904. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  905. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  906. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  907. end
  908. if BULLETCOUNT > 0 then
  909. GunReload:Stop()
  910. end
  911. if BULLETCOUNT <= 0 then
  912. for i = 0, 1, 0.1 do
  913. RenderWait()
  914. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.5) * ANGLES(RAD(70 - 10 * i), RAD(0), RAD(-30)), i)
  915. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(90)) * ANGLES(RAD(0), RAD(-59 - 1 * i), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(0 + 10 * i)), i)
  916. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  917. end
  918. Spawn(function()
  919. RenderWait()
  920. GunChamberBack:Play()
  921. end)
  922. for i = 0, 1, 0.1 do
  923. RenderWait()
  924. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.5) * ANGLES(RAD(60), RAD(0), RAD(-30)), i)
  925. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(0), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(90)) * ANGLES(RAD(0), RAD(-60), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(10)) * CF(0, 0, -0.2), i)
  926. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  927. end
  928. Spawn(function()
  929. RenderWait()
  930. GunChamberForward:Play()
  931. end)
  932. for i = 0, 1, 0.1 do
  933. RenderWait()
  934. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.5) * ANGLES(RAD(60), RAD(0), RAD(-30)), i)
  935. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(90)) * ANGLES(RAD(0), RAD(-60), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(10)), i)
  936. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  937. end
  938. for i = 0, 1, 0.1 do
  939. RenderWait()
  940. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  941. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  942. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  943. end
  944. end
  945. FakeRightShoulder.C0 = CF(1.5, 0.5, 0.5) * ANGLES(RAD(90), RAD(0), RAD(-30))
  946. FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
  947. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
  948. BULLETCOUNT = MAXBULLETS
  949. GUNSTANCE = false
  950. end
  951.  
  952.  
  953.  
  954.  
  955.  
  956. --//=================================\\
  957. --|| SET THINGS UP
  958. --\\=================================//
  959.  
  960. Mouse.Button1Down:connect(function()
  961. MOUSEDOWN = true
  962. if GUNSTANCE == false and EQUIPPED == true then
  963. if BULLETCOUNT > 0 then
  964. Spawn(function()
  965. while MOUSEDOWN == true and BULLETCOUNT > 0 do
  966. if GUNSTANCE == false then
  967. ShootGun()
  968. end
  969. if MOUSEDOWN == false then
  970. break
  971. end
  972. RenderWait()
  973. end
  974. end)
  975. elseif BULLETCOUNT <= 0 then
  976. ReloadGun()
  977. end
  978. end
  979. end)
  980.  
  981. Mouse.Button1Up:connect(function()
  982. MOUSEDOWN = false
  983. end)
  984.  
  985. Mouse.KeyDown:connect(function(KEY)
  986. if KEY == "e" and GUNSTANCE == false then
  987. if EQUIPPED == false then
  988. EQUIPPED = true
  989. else
  990. EQUIPPED = false
  991. end
  992. EquipState(EQUIPPED)
  993. end
  994. if KEY == "r" and GUNSTANCE == false and EQUIPPED == true then
  995. ReloadGun()
  996. end
  997. end)
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004. --//=================================\\
  1005. --|| WRAP THE WHOLE SCRIPT UP
  1006. --\\=================================//
  1007.  
  1008. while true do
  1009. RenderWait()
  1010. SMOKETIME = SMOKETIME - (1 / 30) / 2
  1011. if SMOKETIME <= 0 then
  1012. if GunSmoke.Enabled == true then
  1013. GunSmoke.Enabled = false
  1014. end
  1015. else
  1016. if GunSmoke.Enabled == false then
  1017. GunSmoke.Enabled = true
  1018. end
  1019. end
  1020. end
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026. --//====================================================\\--
  1027. --|| END OF SCRIPT
  1028. --\\====================================================//--
  1029. end))
  1030. Script1.Name = "pistol"
  1031. Script1.Parent = mas
  1032. table.insert(cors,sandbox(Script1,function()
  1033. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  1034. local Player,game,owner = owner,game
  1035. local RealPlayer = Player
  1036. do
  1037. --print("FE Compatibility code V2 by Mokiros")
  1038. local RealPlayer = RealPlayer
  1039. script.Parent = RealPlayer.Character
  1040.  
  1041. --Fake event to make stuff like Mouse.KeyDown work
  1042. local Disconnect_Function = function(this)
  1043. this[1].Functions[this[2]] = nil
  1044. end
  1045. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  1046. local FakeEvent_Metatable = {__index={
  1047. Connect = function(this,f)
  1048. local i = tostring(math.random(0,10000))
  1049. while this.Functions[i] do
  1050. i = tostring(math.random(0,10000))
  1051. end
  1052. this.Functions[i] = f
  1053. return setmetatable({this,i},Disconnect_Metatable)
  1054. end
  1055. }}
  1056. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  1057. local function fakeEvent()
  1058. return setmetatable({Functions={}},FakeEvent_Metatable)
  1059. end
  1060.  
  1061. --Creating fake input objects with fake variables
  1062. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  1063. FakeMouse.keyUp = FakeMouse.KeyUp
  1064. FakeMouse.keyDown = FakeMouse.KeyDown
  1065. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  1066. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  1067. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  1068. end}
  1069. --Merged 2 functions into one by checking amount of arguments
  1070. CAS.UnbindAction = CAS.BindAction
  1071.  
  1072. --This function will trigger the events that have been :Connect()'ed
  1073. local function TriggerEvent(self,ev,...)
  1074. for _,f in pairs(self[ev].Functions) do
  1075. f(...)
  1076. end
  1077. end
  1078. FakeMouse.TriggerEvent = TriggerEvent
  1079. UIS.TriggerEvent = TriggerEvent
  1080.  
  1081. --Client communication
  1082. local Event = Instance.new("RemoteEvent")
  1083. Event.Name = "UserInput_Event"
  1084. Event.OnServerEvent:Connect(function(plr,io)
  1085. if plr~=RealPlayer then return end
  1086. FakeMouse.Target = io.Target
  1087. FakeMouse.Hit = io.Hit
  1088. if not io.isMouse then
  1089. local b = io.UserInputState == Enum.UserInputState.Begin
  1090. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  1091. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  1092. end
  1093. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  1094. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  1095. end
  1096. for _,t in pairs(CAS.Actions) do
  1097. for _,k in pairs(t.Keys) do
  1098. if k==io.KeyCode then
  1099. t.Function(t.Name,io.UserInputState,io)
  1100. end
  1101. end
  1102. end
  1103. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  1104. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  1105. end
  1106. end)
  1107. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  1108. local Mouse = owner:GetMouse()
  1109. local UIS = game:GetService("UserInputService")
  1110. local input = function(io,RobloxHandled)
  1111. if RobloxHandled then return end
  1112. --Since InputObject is a client-side instance, we create and pass table instead
  1113. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  1114. end
  1115. UIS.InputBegan:Connect(input)
  1116. UIS.InputEnded:Connect(input)
  1117. local h,t
  1118. --Give the server mouse data every second frame, but only if the values changed
  1119. --If player is not moving their mouse, client won't fire events
  1120. local HB = game:GetService("RunService").Heartbeat
  1121. while true do
  1122. if h~=Mouse.Hit or t~=Mouse.Target then
  1123. h,t=Mouse.Hit,Mouse.Target
  1124. Event:FireServer({isMouse=true,Target=t,Hit=h})
  1125. end
  1126. --Wait 2 frames
  1127. for i=1,2 do
  1128. HB:Wait()
  1129. end
  1130. end]==],script)
  1131.  
  1132. ----Sandboxed game object that allows the usage of client-side methods and services
  1133. --Real game object
  1134. local RealGame = game
  1135.  
  1136. --Metatable for fake service
  1137. local FakeService_Metatable = {
  1138. __index = function(self,k)
  1139. local s = rawget(self,"_RealService")
  1140. if s then
  1141. return typeof(s[k])=="function"
  1142. and function(_,...)return s[k](s,...)end or s[k]
  1143. end
  1144. end,
  1145. __newindex = function(self,k,v)
  1146. local s = rawget(self,"_RealService")
  1147. if s then s[k]=v end
  1148. end
  1149. }
  1150. local function FakeService(t,RealService)
  1151. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  1152. return setmetatable(t,FakeService_Metatable)
  1153. end
  1154.  
  1155. --Fake game object
  1156. local FakeGame = {
  1157. GetService = function(self,s)
  1158. return rawget(self,s) or RealGame:GetService(s)
  1159. end,
  1160. Players = FakeService({
  1161. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  1162. },"Players"),
  1163. UserInputService = FakeService(UIS,"UserInputService"),
  1164. ContextActionService = FakeService(CAS,"ContextActionService"),
  1165. RunService = FakeService({
  1166. _btrs = {},
  1167. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  1168. BindToRenderStep = function(self,name,_,fun)
  1169. self._btrs[name] = self.Heartbeat:Connect(fun)
  1170. end,
  1171. UnbindFromRenderStep = function(self,name)
  1172. self._btrs[name]:Disconnect()
  1173. end,
  1174. },"RunService")
  1175. }
  1176. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  1177. FakeGame.service = FakeGame.GetService
  1178. FakeService(FakeGame,game)
  1179. --Changing owner to fake player object to support owner:GetMouse()
  1180. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  1181. end
  1182.  
  1183. --//====================================================\\--
  1184. --|| CREATED BY BRANNON1964802
  1185. --\\====================================================//--
  1186.  
  1187.  
  1188.  
  1189. wait(1 / 60)
  1190.  
  1191.  
  1192.  
  1193. Player = game:GetService("Players").LocalPlayer
  1194. PlayerGui = Player.PlayerGui
  1195. Cam = workspace.CurrentCamera
  1196. Backpack = Player.Backpack
  1197. Character = Player.Character
  1198. Humanoid = Character.Humanoid
  1199. Mouse = Player:GetMouse()
  1200. RootPart = Character["HumanoidRootPart"]
  1201. Torso = Character["Torso"]
  1202. Head = Character["Head"]
  1203. Face = Head.face
  1204. RightArm = Character["Right Arm"]
  1205. LeftArm = Character["Left Arm"]
  1206. RightLeg = Character["Right Leg"]
  1207. LeftLeg = Character["Left Leg"]
  1208. RootJoint = RootPart["RootJoint"]
  1209. Neck = Torso["Neck"]
  1210. RightShoulder = Torso["Right Shoulder"]
  1211. LeftShoulder = Torso["Left Shoulder"]
  1212. RightHip = Torso["Right Hip"]
  1213. LeftHip = Torso["Left Hip"]
  1214.  
  1215. IT = Instance.new
  1216. CF = CFrame.new
  1217. VT = Vector3.new
  1218. RAD = math.rad
  1219. C3 = Color3.new
  1220. UD2 = UDim2.new
  1221. BRICKC = BrickColor.new
  1222. ANGLES = CFrame.Angles
  1223. EULER = CFrame.fromEulerAnglesXYZ
  1224. COS = math.cos
  1225. ACOS = math.acos
  1226. SIN = math.sin
  1227. ASIN = math.asin
  1228. ABS = math.abs
  1229. ATAN = math.atan
  1230. SIGN = math.sign
  1231. FREXP = math.frexp
  1232. MRANDOM = math.random
  1233. FLOOR = math.floor
  1234. MHUGE = math.huge
  1235. NUMSEQ = NumberSequence.new
  1236. NUMSEQKEYP = NumberSequenceKeypoint.new
  1237. NUMRANGE = NumberRange.new
  1238. COLORSEQ = ColorSequence.new
  1239. COLORSEQKEYP = ColorSequenceKeypoint.new
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245. --//=================================\\
  1246. --|| USEFUL VALUES
  1247. --\\=================================//
  1248.  
  1249. local EQUIPPED = false
  1250. local GUNSTANCE = false
  1251. local SMOKETIME = 0
  1252. local GUNHANDLEOFFSET = nil
  1253. local MAXBULLETS = 8
  1254. local BULLETCOUNT = MAXBULLETS
  1255. local BulletShellImpactSounds = {"1684805263", "1684805499", "1684805682", "1684805848", "1684806019", "1684806165", "1684806345", "1684806545"}
  1256. local BulletImpactSounds = {"525719118", "525719147", "525719186", "525719232", "525719348", "525719399", "525719421", "525720445", "525720464", "525720500", "525720527", "525720556", "525720625", "525720650"}
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262. --//=================================\\
  1263. --||SOME FUNCTIONS AND WEAPON CREATION
  1264. --\\=================================//
  1265.  
  1266. local WeaponFolder = IT("Folder")
  1267. WeaponFolder.Name = "Weapon"
  1268. local EffectsFolder = workspace--[[IT("Folder")
  1269. EffectsFolder.Name = "Effects"
  1270. EffectsFolder.Parent = WeaponFolder--]]
  1271.  
  1272. local GunHandlePart = IT("Part")
  1273. GunHandlePart.Anchored = false
  1274. GunHandlePart.FormFactor = "Custom"
  1275. GunHandlePart.TopSurface, GunHandlePart.BottomSurface, GunHandlePart.RightSurface, GunHandlePart.LeftSurface, GunHandlePart.FrontSurface, GunHandlePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  1276. GunHandlePart.Name = "Gun Handle Part"
  1277. GunHandlePart.Material = "Plastic"
  1278. GunHandlePart.Reflectance = 0
  1279. GunHandlePart.Transparency = 0
  1280. GunHandlePart.CanCollide = false
  1281. GunHandlePart.Locked = true
  1282. GunHandlePart.BrickColor = BRICKC("Black")
  1283. GunHandlePart.Position = Torso.Position
  1284. GunHandlePart.Size = VT(0.2, 0.2, 0.2)
  1285. GunHandlePart:BreakJoints()
  1286. GunHandlePart.Parent = WeaponFolder
  1287.  
  1288. local GunHandleMesh = IT("SpecialMesh")
  1289. GunHandleMesh.MeshType = "FileMesh"
  1290. GunHandleMesh.MeshId = "rbxassetid://4372594"
  1291. GunHandleMesh.TextureId = ""
  1292. GunHandleMesh.Offset = VT(0, 0.2, 0)
  1293. GunHandleMesh.Scale = VT(1.2, 1.2, 1.2)
  1294. GunHandleMesh.Parent = GunHandlePart
  1295.  
  1296. local GunHandleMotor = IT("Motor")
  1297. GunHandleMotor.C0 = CF(-1, -0.5, 0) * ANGLES(RAD(135), RAD(0), RAD(0))
  1298. GunHandleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  1299. GunHandleMotor.Part0 = Torso
  1300. GunHandleMotor.Part1 = GunHandlePart
  1301. GunHandleMotor.Parent = GunHandlePart
  1302.  
  1303. local GunHolePart = IT("Part")
  1304. GunHolePart.Anchored = false
  1305. GunHolePart.FormFactor = "Custom"
  1306. GunHolePart.TopSurface, GunHolePart.BottomSurface, GunHolePart.RightSurface, GunHolePart.LeftSurface, GunHolePart.FrontSurface, GunHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  1307. GunHolePart.Name = "Gun Hole Part"
  1308. GunHolePart.Material = "Plastic"
  1309. GunHolePart.Reflectance = 0
  1310. GunHolePart.Transparency = 1
  1311. GunHolePart.CanCollide = false
  1312. GunHolePart.Locked = true
  1313. GunHolePart.BrickColor = BRICKC("Medium stone grey")
  1314. GunHolePart.Position = Torso.Position
  1315. GunHolePart.Size = VT(0, 0, 0)
  1316. GunHolePart:BreakJoints()
  1317. GunHolePart.Parent = WeaponFolder
  1318.  
  1319. local GunHoleMotor = IT("Motor")
  1320. GunHoleMotor.C0 = CF(0, 0.66, -0.8) * ANGLES(RAD(0), RAD(0), RAD(0))
  1321. GunHoleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  1322. GunHoleMotor.Part0 = GunHandlePart
  1323. GunHoleMotor.Part1 = GunHolePart
  1324. GunHoleMotor.Parent = GunHandlePart
  1325.  
  1326. local GunShot = IT("Sound")
  1327. GunShot.Looped = false
  1328. GunShot.Volume = 1
  1329. GunShot.Pitch = 1
  1330. GunShot.SoundId = "rbxassetid://10209798" --10209798, 2920959, 10209859
  1331. GunShot.Parent = GunHolePart
  1332.  
  1333. -- 273794772 = Gun Holster/Unholster
  1334.  
  1335. local GunUnholster = IT("Sound")
  1336. GunUnholster.Looped = false
  1337. GunUnholster.Volume = 1
  1338. GunUnholster.Pitch = 1
  1339. GunUnholster.SoundId = "rbxassetid://204223703" --609342351
  1340. GunUnholster.Parent = GunHandlePart
  1341.  
  1342. local GunHolster = IT("Sound")
  1343. GunHolster.Looped = false
  1344. GunHolster.Volume = 1
  1345. GunHolster.Pitch = 1
  1346. GunHolster.SoundId = "rbxassetid://204223703" --656142612, 1567552075, 202243557, 342864661, 204223703, 1244559077
  1347. GunHolster.Parent = GunHandlePart
  1348.  
  1349. local GunReload = IT("Sound")
  1350. GunReload.Looped = false
  1351. GunReload.Volume = 1
  1352. GunReload.Pitch = 1
  1353. GunReload.SoundId = "rbxassetid://10209801" --10209801, 2920960
  1354. GunReload.Parent = GunHandlePart
  1355.  
  1356. local GunChamberBack = IT("Sound")
  1357. GunChamberBack.Looped = false
  1358. GunChamberBack.Volume = 1
  1359. GunChamberBack.Pitch = 1.4
  1360. GunChamberBack.SoundId = "rbxassetid://363762296" --299287260 short version, 268377170 longer version
  1361. GunChamberBack.Parent = GunHandlePart
  1362.  
  1363. local GunChamberForward = IT("Sound")
  1364. GunChamberForward.Looped = false
  1365. GunChamberForward.Volume = 1
  1366. GunChamberForward.Pitch = 1.4
  1367. GunChamberForward.SoundId = "rbxassetid://364490777"
  1368. GunChamberForward.Parent = GunHandlePart
  1369.  
  1370. local GunSmoke = IT("ParticleEmitter")
  1371. GunSmoke.Enabled = false
  1372. GunSmoke.Texture = "rbxassetid://528256032"
  1373. GunSmoke.Size = NUMSEQ(
  1374. {
  1375. NUMSEQKEYP(
  1376. 0, 0.1, 0.05
  1377. ),
  1378. NUMSEQKEYP(
  1379. 1, 0.1, 0.05
  1380. )
  1381. }
  1382. )
  1383. GunSmoke.Transparency = NUMSEQ(
  1384. {
  1385. NUMSEQKEYP(
  1386. 0, 0.9, 0
  1387. ),
  1388. NUMSEQKEYP(
  1389. 1, 1, 0
  1390. )
  1391. }
  1392. )
  1393. GunSmoke.Color = COLORSEQ(
  1394. {
  1395. COLORSEQKEYP(
  1396. 0, C3(255 / 255, 255 / 255, 255 / 255)
  1397. ),
  1398. COLORSEQKEYP(
  1399. 1, C3(255 / 255, 255 / 255, 255 / 255)
  1400. )
  1401. }
  1402. )
  1403. GunSmoke.VelocitySpread = 360
  1404. GunSmoke.Lifetime = NUMRANGE(1, 1)
  1405. GunSmoke.Speed = NUMRANGE(0.5, 0.5)
  1406. GunSmoke.Acceleration = VT(0, 2 * 5, 0)
  1407. GunSmoke.Drag = 10
  1408. GunSmoke.VelocityInheritance = 1
  1409. GunSmoke.Rate = 1000
  1410. GunSmoke.LightInfluence = 1
  1411. GunSmoke.LightEmission = 0
  1412. GunSmoke.ZOffset = 0.1
  1413. GunSmoke.EmissionDirection = "Top"
  1414. GunSmoke.Rotation = NUMRANGE(-360, 360)
  1415. GunSmoke.RotSpeed = NUMRANGE(-10, 10)
  1416. GunSmoke.LockedToPart = false
  1417. GunSmoke.Parent = GunHolePart
  1418.  
  1419. local GunShotEffect = IT("ParticleEmitter")
  1420. GunShotEffect.Enabled = false
  1421. GunShotEffect.Texture = "rbxassetid://243728166"
  1422. GunShotEffect.Size = NUMSEQ(
  1423. {
  1424. NUMSEQKEYP(
  1425. 0, 1, 0
  1426. ),
  1427. NUMSEQKEYP(
  1428. 1, 1, 0
  1429. )
  1430. }
  1431. )
  1432. GunShotEffect.Transparency = NUMSEQ(
  1433. {
  1434. NUMSEQKEYP(
  1435. 0, 0
  1436. ),
  1437. NUMSEQKEYP(
  1438. 1, 1
  1439. )
  1440. }
  1441. )
  1442. GunShotEffect.Color = COLORSEQ(
  1443. {
  1444. COLORSEQKEYP(
  1445. 0, C3(255 / 255, 170 / 255, 128 / 255)
  1446. ),
  1447. COLORSEQKEYP(
  1448. 1, C3(255 / 255, 170 / 255, 128 / 255)
  1449. )
  1450. }
  1451. )
  1452. GunShotEffect.VelocitySpread = 0
  1453. GunShotEffect.Lifetime = NUMRANGE(0.06, 0.06)
  1454. GunShotEffect.Speed = NUMRANGE(0, 0)
  1455. GunShotEffect.Acceleration = VT(0, 0, 0)
  1456. GunShotEffect.Drag = 0
  1457. GunShotEffect.VelocityInheritance = 0
  1458. GunShotEffect.Rate = 0
  1459. GunShotEffect.LightInfluence = 0
  1460. GunShotEffect.LightEmission = 1
  1461. GunShotEffect.ZOffset = 0.1
  1462. GunShotEffect.EmissionDirection = "Top"
  1463. GunShotEffect.Rotation = NUMRANGE(-360, 360)
  1464. GunShotEffect.RotSpeed = NUMRANGE(0, 0)
  1465. GunShotEffect.LockedToPart = true
  1466. GunShotEffect.Parent = GunHolePart
  1467.  
  1468. local GunLight = IT("PointLight")
  1469. GunLight.Enabled = true
  1470. GunLight.Brightness = 1000
  1471. GunLight.Color = C3(255 / 255, 170 / 255, 128 / 255)
  1472. GunLight.Shadows = true
  1473. GunLight.Range = 0
  1474. GunLight.Parent = GunHolePart
  1475.  
  1476. local FakeRightShoulder = IT("Weld")
  1477. FakeRightShoulder.Name = "Right Shoulder"
  1478. FakeRightShoulder.Part0 = Torso
  1479. FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  1480. FakeRightShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  1481. FakeRightShoulder.Part1 = RightArm
  1482.  
  1483. local FakeLeftShoulder = IT("Weld")
  1484. FakeLeftShoulder.Name = "Right Shoulder"
  1485. FakeLeftShoulder.Part0 = Torso
  1486. FakeLeftShoulder.C0 = CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  1487. FakeLeftShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  1488. FakeLeftShoulder.Part1 = LeftArm
  1489.  
  1490. WeaponFolder.Parent = Character
  1491.  
  1492. local function Clerp(INSTANCE, COORDINATE, TIME)
  1493. return INSTANCE:lerp(COORDINATE, TIME)
  1494. end
  1495.  
  1496. local function RenderWait(TIME)
  1497. if TIME == nil or TIME == 0 then
  1498. game:GetService("RunService").Heartbeat:wait()
  1499. else
  1500. for i = 1, TIME do
  1501. game:GetService("RunService").Heartbeat:wait()
  1502. end
  1503. end
  1504. end
  1505.  
  1506. local function EquipState(CURRENTSTATE)
  1507. GUNSTANCE = true
  1508. if CURRENTSTATE == true then
  1509. RightShoulder.Parent = nil
  1510. FakeRightShoulder.Parent = Torso
  1511. for i = 0, 1, 0.05 do
  1512. RenderWait()
  1513. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(0.1 - 0.1 * i, 0, -1.1 + 0.1 * i) * ANGLES(RAD(90), RAD(0), RAD(-80 - 10 * i)) * ANGLES(RAD(-45), RAD(89 + 1 * i), RAD(0)), i)
  1514. end
  1515. GUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
  1516. GunHandleMotor.Part0 = RightArm
  1517. GunHandleMotor.C0 = GUNHANDLEOFFSET
  1518. Spawn(function()
  1519. RenderWait()
  1520. GunUnholster:Play()
  1521. end)
  1522. --[[
  1523. for i = 0, 1, 0.05 do
  1524. RenderWait()
  1525. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(90)) * ANGLES(RAD(1 - 11 * i), RAD(0), RAD(0)), i)
  1526. end
  1527. --]]
  1528. for i = 0, 1, 0.05 do
  1529. RenderWait()
  1530. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(100 - 10 * i), RAD(1 - 1 * i), RAD(10 - 10 * i)), i)
  1531. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
  1532. end
  1533. FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(90), RAD(0), RAD(0))
  1534. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0))
  1535. else
  1536. Spawn(function()
  1537. RenderWait()
  1538. GunHolster:Play()
  1539. end)
  1540. for i = 0, 1, 0.05 do
  1541. RenderWait()
  1542. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(0.1 - 0.1 * i, 0, -1.1 + 0.1 * i) * ANGLES(RAD(90), RAD(0), RAD(-80 - 10 * i)) * ANGLES(RAD(-45), RAD(89 + 1 * i), RAD(0)), i)
  1543. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, GUNHANDLEOFFSET, i)
  1544. end
  1545. GUNHANDLEOFFSET = Torso.CFrame:toObjectSpace(GunHandlePart.CFrame)
  1546. GunHandleMotor.Part0 = Torso
  1547. GunHandleMotor.C0 = GUNHANDLEOFFSET
  1548. for i = 0, 1, 0.05 do
  1549. RenderWait()
  1550. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(1 - 1 * i), RAD(0)), i)
  1551. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(-1, -0.5, 0) * ANGLES(RAD(135), RAD(0), RAD(0)), i)
  1552. end
  1553. FakeRightShoulder.Parent = nil
  1554. RightShoulder.Parent = Torso
  1555. GunHandleMotor.C0 = CF(-1, -0.5, 0) * ANGLES(RAD(135), RAD(0), RAD(0))
  1556. end
  1557. GUNSTANCE = false
  1558. end
  1559.  
  1560. local function BulletHole(POSITION, EFFECTCOLOR)
  1561. local BulletHolePart = IT("Part")
  1562. BulletHolePart.Anchored = true
  1563. BulletHolePart.FormFactor = "Custom"
  1564. BulletHolePart.TopSurface, BulletHolePart.BottomSurface, BulletHolePart.RightSurface, BulletHolePart.LeftSurface, BulletHolePart.FrontSurface, BulletHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  1565. BulletHolePart.Name = "Bullet Hole"
  1566. BulletHolePart.Material = "Plastic"
  1567. BulletHolePart.Reflectance = 0
  1568. BulletHolePart.Transparency = 1
  1569. BulletHolePart.CanCollide = false
  1570. BulletHolePart.Locked = true
  1571. BulletHolePart.BrickColor = BRICKC("Medium stone grey")
  1572. BulletHolePart.Size = VT(0.3, 0, 0.3)
  1573. BulletHolePart:BreakJoints()
  1574. BulletHolePart.CFrame = POSITION
  1575. BulletHolePart.Parent = EffectsFolder
  1576. game:GetService("Debris"):AddItem(BulletHolePart, 5)
  1577. local BulletHoleDecal = IT("Decal")
  1578. BulletHoleDecal.Color3 = C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  1579. BulletHoleDecal.Face = "Top"
  1580. BulletHoleDecal.Texture = "rbxassetid://359667865"
  1581. BulletHoleDecal.Transparency = 0
  1582. BulletHoleDecal.Parent = BulletHolePart
  1583. local BulletHoleSound = IT("Sound")
  1584. BulletHoleSound.Looped = false
  1585. BulletHoleSound.Volume = 1
  1586. BulletHoleSound.Pitch = MRANDOM(80, 120) / 100
  1587. BulletHoleSound.SoundId = "rbxassetid://"..BulletImpactSounds[13]
  1588. BulletHoleSound.Parent = BulletHolePart
  1589. local BulletHoleSound2 = IT("Sound")
  1590. BulletHoleSound2.Looped = false
  1591. BulletHoleSound2.Volume = 1
  1592. BulletHoleSound2.Pitch = MRANDOM(80, 120) / 100
  1593. BulletHoleSound2.SoundId = "rbxassetid://196864064"
  1594. BulletHoleSound2.Parent = BulletHolePart
  1595. local BulletImpactEffect = IT("ParticleEmitter")
  1596. BulletImpactEffect.Enabled = false
  1597. BulletImpactEffect.Texture = "rbxassetid://241685484"
  1598. BulletImpactEffect.Size = NUMSEQ(
  1599. {
  1600. NUMSEQKEYP(
  1601. 0, 0.05, 0.025
  1602. ),
  1603. NUMSEQKEYP(
  1604. 1, 0.05, 0.025
  1605. )
  1606. }
  1607. )
  1608. BulletImpactEffect.Transparency = NUMSEQ(
  1609. {
  1610. NUMSEQKEYP(
  1611. 0, 0, 0
  1612. ),
  1613. NUMSEQKEYP(
  1614. 1, 1, 0
  1615. )
  1616. }
  1617. )
  1618. BulletImpactEffect.Color = COLORSEQ(
  1619. {
  1620. COLORSEQKEYP(
  1621. 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  1622. ),
  1623. COLORSEQKEYP(
  1624. 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
  1625. )
  1626. }
  1627. )
  1628. BulletImpactEffect.VelocitySpread = 45
  1629. BulletImpactEffect.Lifetime = NUMRANGE(0.2, 0.2)
  1630. BulletImpactEffect.Speed = NUMRANGE(30, 30)
  1631. BulletImpactEffect.Acceleration = VT(0, -196.2, 0)
  1632. BulletImpactEffect.Drag = 0
  1633. BulletImpactEffect.VelocityInheritance = 0
  1634. BulletImpactEffect.Rate = 0
  1635. BulletImpactEffect.LightInfluence = 1
  1636. BulletImpactEffect.LightEmission = 0
  1637. BulletImpactEffect.ZOffset = 0
  1638. BulletImpactEffect.EmissionDirection = "Top"
  1639. BulletImpactEffect.Rotation = NUMRANGE(-360, 360)
  1640. BulletImpactEffect.RotSpeed = NUMRANGE(-360, 360)
  1641. BulletImpactEffect.LockedToPart = false
  1642. BulletImpactEffect.Parent = BulletHolePart
  1643. local BulletImpactEffect2 = IT("ParticleEmitter")
  1644. BulletImpactEffect2.Enabled = false
  1645. BulletImpactEffect2.Texture = "rbxassetid://709137722"
  1646. BulletImpactEffect2.Size = NUMSEQ(
  1647. {
  1648. NUMSEQKEYP(
  1649. 0, 0.5, 0
  1650. ),
  1651. NUMSEQKEYP(
  1652. 1, 0.5, 0
  1653. )
  1654. }
  1655. )
  1656. BulletImpactEffect2.Transparency = NUMSEQ(
  1657. {
  1658. NUMSEQKEYP(
  1659. 0, 0, 0
  1660. ),
  1661. NUMSEQKEYP(
  1662. 1, 1, 0
  1663. )
  1664. }
  1665. )
  1666. BulletImpactEffect2.Color = COLORSEQ(
  1667. {
  1668. COLORSEQKEYP(
  1669. 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  1670. ),
  1671. COLORSEQKEYP(
  1672. 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
  1673. )
  1674. }
  1675. )
  1676. BulletImpactEffect2.VelocitySpread = 10
  1677. BulletImpactEffect2.Lifetime = NUMRANGE(0.2, 0.2)
  1678. BulletImpactEffect2.Speed = NUMRANGE(2, 2)
  1679. BulletImpactEffect2.Acceleration = VT(0, 0, 0)
  1680. BulletImpactEffect2.Drag = 0
  1681. BulletImpactEffect2.VelocityInheritance = 0
  1682. BulletImpactEffect2.Rate = 0
  1683. BulletImpactEffect2.LightInfluence = 1
  1684. BulletImpactEffect2.LightEmission = 0
  1685. BulletImpactEffect2.ZOffset = 0.4
  1686. BulletImpactEffect2.EmissionDirection = "Top"
  1687. BulletImpactEffect2.Rotation = NUMRANGE(-360, 360)
  1688. BulletImpactEffect2.RotSpeed = NUMRANGE(-360, 360)
  1689. BulletImpactEffect2.LockedToPart = false
  1690. BulletImpactEffect2.Parent = BulletHolePart
  1691. Spawn(function()
  1692. RenderWait()
  1693. BulletImpactEffect:Emit(MRANDOM(5, 15))
  1694. BulletImpactEffect2:Emit(MRANDOM(1, 1))
  1695. BulletHoleSound:Play()
  1696. BulletHoleSound2:Play()
  1697. end)
  1698. end
  1699.  
  1700. local function FakeBullet(POSITION, VELOCITY)
  1701. local FakeBulletPart = IT("Part")
  1702. FakeBulletPart.Anchored = false
  1703. FakeBulletPart.FormFactor = "Custom"
  1704. FakeBulletPart.TopSurface, FakeBulletPart.BottomSurface, FakeBulletPart.RightSurface, FakeBulletPart.LeftSurface, FakeBulletPart.FrontSurface, FakeBulletPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  1705. FakeBulletPart.Name = "Bullet Shell"
  1706. FakeBulletPart.Material = "Plastic"
  1707. FakeBulletPart.Reflectance = 0
  1708. FakeBulletPart.Transparency = 0
  1709. FakeBulletPart.CanCollide = true
  1710. FakeBulletPart.Locked = true
  1711. FakeBulletPart.BrickColor = BRICKC("Bright yellow")
  1712. FakeBulletPart.Size = VT(0.22, 0.12, 0.12)
  1713. FakeBulletPart:BreakJoints()
  1714. FakeBulletPart.CFrame = POSITION
  1715. local FakeBulletMesh = IT("SpecialMesh")
  1716. FakeBulletMesh.MeshType = "Cylinder"
  1717. FakeBulletMesh.MeshId = ""
  1718. FakeBulletMesh.TextureId = ""
  1719. FakeBulletMesh.Offset = VT(0, 0, 0)
  1720. FakeBulletMesh.Scale = VT(1, 1, 1)
  1721. FakeBulletMesh.Parent = FakeBulletPart
  1722. FakeBulletPart.Parent = EffectsFolder
  1723. FakeBulletPart.Velocity = VELOCITY
  1724. game:GetService("Debris"):AddItem(FakeBulletPart, 3)
  1725. --[[
  1726. local BulletContact = IT("Sound")
  1727. BulletContact.Looped = false
  1728. BulletContact.Volume = 0.5
  1729. BulletContact.Pitch = 1
  1730. BulletContact.SoundId = "rbxassetid://"..BulletShellImpactSounds[5]
  1731. BulletContact.Parent = FakeBulletPart
  1732. local HITSOMETHING = false
  1733. FakeBulletPart.Touched:connect(function()
  1734. if HITSOMETHING == false then
  1735. HITSOMETHING = true
  1736. Spawn(function()
  1737. RenderWait()
  1738. BulletContact:Play()
  1739. end)
  1740. end
  1741. end)
  1742. --]]
  1743. end
  1744.  
  1745. local function FakeClip(POSITION, VELOCITY)
  1746. local FakeClipPart = IT("Part")
  1747. FakeClipPart.Anchored = false
  1748. FakeClipPart.FormFactor = "Custom"
  1749. FakeClipPart.TopSurface, FakeClipPart.BottomSurface, FakeClipPart.RightSurface, FakeClipPart.LeftSurface, FakeClipPart.FrontSurface, FakeClipPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  1750. FakeClipPart.Name = "Clip"
  1751. FakeClipPart.Material = "Plastic"
  1752. FakeClipPart.Reflectance = 0
  1753. FakeClipPart.Transparency = 0
  1754. FakeClipPart.CanCollide = true
  1755. FakeClipPart.Locked = true
  1756. FakeClipPart.BrickColor = BRICKC("Black")
  1757. FakeClipPart.Size = VT(0.2, 0.8, 0.3)
  1758. FakeClipPart:BreakJoints()
  1759. FakeClipPart.CFrame = POSITION
  1760. FakeClipPart.Parent = EffectsFolder
  1761. FakeClipPart.Velocity = VELOCITY
  1762. game:GetService("Debris"):AddItem(FakeClipPart, 3)
  1763. end
  1764.  
  1765. local function ShootGun()
  1766. GUNSTANCE = true
  1767. local HITHUMANOID = nil
  1768. spawn(function()
  1769. RenderWait()
  1770. GunShot.Pitch = MRANDOM(90, 110) / 100
  1771. GunShot:Play()
  1772. if (BULLETCOUNT - 1) < 0 then
  1773. GunChamberBack:Play()
  1774. end
  1775. end)
  1776. GunShotEffect:Emit(MRANDOM(4, 6))
  1777. GunLight.Range = 8
  1778. FakeBullet(GunHandlePart.CFrame * CF(0, 0.7, -0.05) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20))), (GunHandlePart.CFrame * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(30), RAD(0), RAD(0))).lookVector * 20)
  1779. BULLETCOUNT = BULLETCOUNT - 1
  1780. local GUNSPREAD = VT(MRANDOM(-100, 100) / 100, MRANDOM(-100, 100) / 100, MRANDOM(-100, 100) / 100) * ((GunHolePart.Position - Mouse.Hit.p).magnitude / 100)
  1781. local GUNRAYHIT, GUNRAYPOSITION, GUNRAYANGLE = game:GetService("Workspace").FindPartOnRay(game:GetService("Workspace"), Ray.new(GunHolePart.Position, (CF(GunHolePart.Position, Mouse.Hit.p + GUNSPREAD).lookVector).unit * 1000), Character)
  1782. if GUNRAYHIT ~= nil then
  1783. if GUNRAYHIT.Parent:FindFirstChild("Humanoid") then
  1784. HITHUMANOID = GUNRAYHIT.Parent:FindFirstChild("Humanoid")
  1785. else
  1786. if GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid") then
  1787. HITHUMANOID = GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid")
  1788. end
  1789. end
  1790. if HITHUMANOID ~= nil and HITHUMANOID.Parent ~= Character then
  1791. HITHUMANOID.Health = HITHUMANOID.Health - (HITHUMANOID.MaxHealth * (math.random(2,3)/10))
  1792. else
  1793. BulletHole(CF(GUNRAYPOSITION, GUNRAYPOSITION - GUNRAYANGLE) * ANGLES(RAD(90), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(MRANDOM(-360, 360)), RAD(0)), GUNRAYHIT.BrickColor)
  1794. end
  1795. end
  1796. SMOKETIME = 2
  1797. for i = 0, 1, 0.2 do
  1798. RenderWait()
  1799. GunLight.Range = 8 - (8 * i)
  1800. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.1) * ANGLES(RAD(90 + 10 * i), RAD(0), RAD(0)), i)
  1801. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
  1802. end
  1803. GunLight.Range = 0
  1804. for i = 0, 1, 0.2 do
  1805. RenderWait()
  1806. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(100 - 10 * i), RAD(0), RAD(0)), i)
  1807. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
  1808. end
  1809. FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(90), RAD(0), RAD(0))
  1810. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0))
  1811. GUNSTANCE = false
  1812. end
  1813.  
  1814. local function ReloadGun()
  1815. GUNSTANCE = true
  1816. Spawn(function()
  1817. RenderWait()
  1818. GunReload:Play()
  1819. end)
  1820. FakeClip(GunHandlePart.CFrame * CF(0, 0, 0.45) * ANGLES(RAD(-15), RAD(0), RAD(0)), (GunHandlePart.CFrame * ANGLES(RAD(-90), RAD(0), RAD(0))).lookVector * 10)
  1821. for i = 0, 1, 0.04 do
  1822. RenderWait()
  1823. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(125 + 10 * i), RAD(0), RAD(0)), i)
  1824. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90 + 390 * i), RAD(0), RAD(0)) * CF(0, -0.2, -0.4), i)
  1825. end
  1826. for i = 0, 1, 0.06 do
  1827. RenderWait()
  1828. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)), i)
  1829. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90 - 30 * i), RAD(0), RAD(0)) * CF(0, -0.2, -0.4), i)
  1830. end
  1831. for i = 0, 1, 0.05 do
  1832. RenderWait()
  1833. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(125 + 10 * i), RAD(0), RAD(0)), i)
  1834. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90 + 390 * i), RAD(0), RAD(0)) * CF(0, -0.2, -0.4), i)
  1835. end
  1836. for i = 0, 1, 0.05 do
  1837. RenderWait()
  1838. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(100 - 10 * i), RAD(0), RAD(0)), i)
  1839. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-60 - 30 * i), RAD(0), RAD(0)), i)
  1840. end
  1841. if BULLETCOUNT <= 0 then
  1842. for i = 0, 1, 0.05 do
  1843. RenderWait()
  1844. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(90 + 10 * i), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(10), RAD(0)), i)
  1845. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
  1846. end
  1847. Spawn(function()
  1848. RenderWait()
  1849. GunChamberForward:Play()
  1850. end)
  1851. for i = 0, 1, 0.05 do
  1852. RenderWait()
  1853. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(80 + 10 * i), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(-10 + 10 * i), RAD(0)), i)
  1854. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
  1855. end
  1856. end
  1857. FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(90), RAD(0), RAD(0))
  1858. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0))
  1859. BULLETCOUNT = MAXBULLETS
  1860. GUNSTANCE = false
  1861. end
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867. --//=================================\\
  1868. --|| SET THINGS UP
  1869. --\\=================================//
  1870.  
  1871. Mouse.Button1Down:connect(function()
  1872. if GUNSTANCE == false and EQUIPPED == true then
  1873. if BULLETCOUNT > 0 then
  1874. ShootGun()
  1875. elseif BULLETCOUNT <= 0 then
  1876. ReloadGun()
  1877. end
  1878. end
  1879. end)
  1880.  
  1881. Mouse.KeyDown:connect(function(KEY)
  1882. if KEY == "q" and GUNSTANCE == false then
  1883. if EQUIPPED == false then
  1884. EQUIPPED = true
  1885. else
  1886. EQUIPPED = false
  1887. end
  1888. EquipState(EQUIPPED)
  1889. end
  1890. if KEY == "r" and GUNSTANCE == false and EQUIPPED == true then
  1891. ReloadGun()
  1892. end
  1893. end)
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900. --//=================================\\
  1901. --|| WRAP THE WHOLE SCRIPT UP
  1902. --\\=================================//
  1903.  
  1904. while true do
  1905. RenderWait()
  1906. SMOKETIME = SMOKETIME - (1 / 30) / 2
  1907. if SMOKETIME <= 0 then
  1908. if GunSmoke.Enabled == true then
  1909. GunSmoke.Enabled = false
  1910. end
  1911. else
  1912. if GunSmoke.Enabled == false then
  1913. GunSmoke.Enabled = true
  1914. end
  1915. end
  1916. end
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922. --//====================================================\\--
  1923. --|| END OF SCRIPT
  1924. --\\====================================================//--
  1925. end))
  1926. Script2.Name = "shotgun"
  1927. Script2.Parent = mas
  1928. table.insert(cors,sandbox(Script2,function()
  1929. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  1930. local Player,game,owner = owner,game
  1931. local RealPlayer = Player
  1932. do
  1933. --print("FE Compatibility code V2 by Mokiros")
  1934. local RealPlayer = RealPlayer
  1935. script.Parent = RealPlayer.Character
  1936.  
  1937. --Fake event to make stuff like Mouse.KeyDown work
  1938. local Disconnect_Function = function(this)
  1939. this[1].Functions[this[2]] = nil
  1940. end
  1941. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  1942. local FakeEvent_Metatable = {__index={
  1943. Connect = function(this,f)
  1944. local i = tostring(math.random(0,10000))
  1945. while this.Functions[i] do
  1946. i = tostring(math.random(0,10000))
  1947. end
  1948. this.Functions[i] = f
  1949. return setmetatable({this,i},Disconnect_Metatable)
  1950. end
  1951. }}
  1952. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  1953. local function fakeEvent()
  1954. return setmetatable({Functions={}},FakeEvent_Metatable)
  1955. end
  1956.  
  1957. --Creating fake input objects with fake variables
  1958. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  1959. FakeMouse.keyUp = FakeMouse.KeyUp
  1960. FakeMouse.keyDown = FakeMouse.KeyDown
  1961. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  1962. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  1963. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  1964. end}
  1965. --Merged 2 functions into one by checking amount of arguments
  1966. CAS.UnbindAction = CAS.BindAction
  1967.  
  1968. --This function will trigger the events that have been :Connect()'ed
  1969. local function TriggerEvent(self,ev,...)
  1970. for _,f in pairs(self[ev].Functions) do
  1971. f(...)
  1972. end
  1973. end
  1974. FakeMouse.TriggerEvent = TriggerEvent
  1975. UIS.TriggerEvent = TriggerEvent
  1976.  
  1977. --Client communication
  1978. local Event = Instance.new("RemoteEvent")
  1979. Event.Name = "UserInput_Event"
  1980. Event.OnServerEvent:Connect(function(plr,io)
  1981. if plr~=RealPlayer then return end
  1982. FakeMouse.Target = io.Target
  1983. FakeMouse.Hit = io.Hit
  1984. if not io.isMouse then
  1985. local b = io.UserInputState == Enum.UserInputState.Begin
  1986. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  1987. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  1988. end
  1989. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  1990. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  1991. end
  1992. for _,t in pairs(CAS.Actions) do
  1993. for _,k in pairs(t.Keys) do
  1994. if k==io.KeyCode then
  1995. t.Function(t.Name,io.UserInputState,io)
  1996. end
  1997. end
  1998. end
  1999. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  2000. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  2001. end
  2002. end)
  2003. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  2004. local Mouse = owner:GetMouse()
  2005. local UIS = game:GetService("UserInputService")
  2006. local input = function(io,RobloxHandled)
  2007. if RobloxHandled then return end
  2008. --Since InputObject is a client-side instance, we create and pass table instead
  2009. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  2010. end
  2011. UIS.InputBegan:Connect(input)
  2012. UIS.InputEnded:Connect(input)
  2013. local h,t
  2014. --Give the server mouse data every second frame, but only if the values changed
  2015. --If player is not moving their mouse, client won't fire events
  2016. local HB = game:GetService("RunService").Heartbeat
  2017. while true do
  2018. if h~=Mouse.Hit or t~=Mouse.Target then
  2019. h,t=Mouse.Hit,Mouse.Target
  2020. Event:FireServer({isMouse=true,Target=t,Hit=h})
  2021. end
  2022. --Wait 2 frames
  2023. for i=1,2 do
  2024. HB:Wait()
  2025. end
  2026. end]==],script)
  2027.  
  2028. ----Sandboxed game object that allows the usage of client-side methods and services
  2029. --Real game object
  2030. local RealGame = game
  2031.  
  2032. --Metatable for fake service
  2033. local FakeService_Metatable = {
  2034. __index = function(self,k)
  2035. local s = rawget(self,"_RealService")
  2036. if s then
  2037. return typeof(s[k])=="function"
  2038. and function(_,...)return s[k](s,...)end or s[k]
  2039. end
  2040. end,
  2041. __newindex = function(self,k,v)
  2042. local s = rawget(self,"_RealService")
  2043. if s then s[k]=v end
  2044. end
  2045. }
  2046. local function FakeService(t,RealService)
  2047. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  2048. return setmetatable(t,FakeService_Metatable)
  2049. end
  2050.  
  2051. --Fake game object
  2052. local FakeGame = {
  2053. GetService = function(self,s)
  2054. return rawget(self,s) or RealGame:GetService(s)
  2055. end,
  2056. Players = FakeService({
  2057. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  2058. },"Players"),
  2059. UserInputService = FakeService(UIS,"UserInputService"),
  2060. ContextActionService = FakeService(CAS,"ContextActionService"),
  2061. RunService = FakeService({
  2062. _btrs = {},
  2063. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  2064. BindToRenderStep = function(self,name,_,fun)
  2065. self._btrs[name] = self.Heartbeat:Connect(fun)
  2066. end,
  2067. UnbindFromRenderStep = function(self,name)
  2068. self._btrs[name]:Disconnect()
  2069. end,
  2070. },"RunService")
  2071. }
  2072. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  2073. FakeGame.service = FakeGame.GetService
  2074. FakeService(FakeGame,game)
  2075. --Changing owner to fake player object to support owner:GetMouse()
  2076. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  2077. end
  2078.  
  2079. --//====================================================\\--
  2080. --|| CREATED BY BRANNON1964802
  2081. --\\====================================================//--
  2082.  
  2083.  
  2084.  
  2085. wait(1 / 60)
  2086.  
  2087.  
  2088.  
  2089. Player = game:GetService("Players").LocalPlayer
  2090. PlayerGui = Player.PlayerGui
  2091. Cam = workspace.CurrentCamera
  2092. Backpack = Player.Backpack
  2093. Character = Player.Character
  2094. Humanoid = Character.Humanoid
  2095. Mouse = Player:GetMouse()
  2096. RootPart = Character["HumanoidRootPart"]
  2097. Torso = Character["Torso"]
  2098. Head = Character["Head"]
  2099. Face = Head.face
  2100. RightArm = Character["Right Arm"]
  2101. LeftArm = Character["Left Arm"]
  2102. RightLeg = Character["Right Leg"]
  2103. LeftLeg = Character["Left Leg"]
  2104. RootJoint = RootPart["RootJoint"]
  2105. Neck = Torso["Neck"]
  2106. RightShoulder = Torso["Right Shoulder"]
  2107. LeftShoulder = Torso["Left Shoulder"]
  2108. RightHip = Torso["Right Hip"]
  2109. LeftHip = Torso["Left Hip"]
  2110.  
  2111. IT = Instance.new
  2112. CF = CFrame.new
  2113. VT = Vector3.new
  2114. RAD = math.rad
  2115. C3 = Color3.new
  2116. UD2 = UDim2.new
  2117. BRICKC = BrickColor.new
  2118. ANGLES = CFrame.Angles
  2119. EULER = CFrame.fromEulerAnglesXYZ
  2120. COS = math.cos
  2121. ACOS = math.acos
  2122. SIN = math.sin
  2123. ASIN = math.asin
  2124. ABS = math.abs
  2125. ATAN = math.atan
  2126. SIGN = math.sign
  2127. FREXP = math.frexp
  2128. MRANDOM = math.random
  2129. FLOOR = math.floor
  2130. MHUGE = math.huge
  2131. NUMSEQ = NumberSequence.new
  2132. NUMSEQKEYP = NumberSequenceKeypoint.new
  2133. NUMRANGE = NumberRange.new
  2134. COLORSEQ = ColorSequence.new
  2135. COLORSEQKEYP = ColorSequenceKeypoint.new
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141. --//=================================\\
  2142. --|| USEFUL VALUES
  2143. --\\=================================//
  2144.  
  2145. local EQUIPPED = false
  2146. local GUNSTANCE = false
  2147. local MOUSEDOWN = false
  2148. local MOUSEDOWN2 = false
  2149. local CHAMBEREMPTY = false
  2150. local SMOKETIME = 0
  2151. local GUNHANDLEOFFSET = nil
  2152. local MAXBULLETS = 6
  2153. local BULLETCOUNT = MAXBULLETS
  2154. local BulletShellImpactSounds = {"1684805263", "1684805499", "1684805682", "1684805848", "1684806019", "1684806165", "1684806345", "1684806545"}
  2155. local BulletImpactSounds = {"525719118", "525719147", "525719186", "525719232", "525719348", "525719399", "525719421", "525720445", "525720464", "525720500", "525720527", "525720556", "525720625", "525720650"}
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161. --//=================================\\
  2162. --||SOME FUNCTIONS AND WEAPON CREATION
  2163. --\\=================================//
  2164.  
  2165. local WeaponFolder = IT("Folder")
  2166. WeaponFolder.Name = "Weapon"
  2167. local EffectsFolder = workspace--[[IT("Folder")
  2168. EffectsFolder.Name = "Effects"
  2169. EffectsFolder.Parent = WeaponFolder--]]
  2170.  
  2171. local GunHandlePart = IT("Part")
  2172. GunHandlePart.Anchored = false
  2173. GunHandlePart.FormFactor = "Custom"
  2174. GunHandlePart.TopSurface, GunHandlePart.BottomSurface, GunHandlePart.RightSurface, GunHandlePart.LeftSurface, GunHandlePart.FrontSurface, GunHandlePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  2175. GunHandlePart.Name = "Gun Handle Part"
  2176. GunHandlePart.Material = "Plastic"
  2177. GunHandlePart.Reflectance = 0
  2178. GunHandlePart.Transparency = 0
  2179. GunHandlePart.CanCollide = false
  2180. GunHandlePart.Locked = true
  2181. GunHandlePart.BrickColor = BRICKC("Black")
  2182. GunHandlePart.Position = Torso.Position
  2183. GunHandlePart.Size = VT(0.2, 0.2, 0.2)
  2184. GunHandlePart:BreakJoints()
  2185. GunHandlePart.Parent = WeaponFolder
  2186.  
  2187. local GunHandleMesh = IT("SpecialMesh")
  2188. GunHandleMesh.MeshType = "FileMesh"
  2189. GunHandleMesh.MeshId = "rbxassetid://3835506"
  2190. GunHandleMesh.TextureId = ""
  2191. GunHandleMesh.Offset = VT(0, 0.3, -0.6)
  2192. GunHandleMesh.Scale = VT(1.2, 1.2, 1)
  2193. GunHandleMesh.Parent = GunHandlePart
  2194.  
  2195. local GunHandleMotor = IT("Motor")
  2196. GunHandleMotor.C0 = CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
  2197. GunHandleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  2198. GunHandleMotor.Part0 = Torso
  2199. GunHandleMotor.Part1 = GunHandlePart
  2200. GunHandleMotor.Parent = GunHandlePart
  2201.  
  2202. local GunHolePart = IT("Part")
  2203. GunHolePart.Anchored = false
  2204. GunHolePart.FormFactor = "Custom"
  2205. GunHolePart.TopSurface, GunHolePart.BottomSurface, GunHolePart.RightSurface, GunHolePart.LeftSurface, GunHolePart.FrontSurface, GunHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  2206. GunHolePart.Name = "Gun Hole Part"
  2207. GunHolePart.Material = "Plastic"
  2208. GunHolePart.Reflectance = 0
  2209. GunHolePart.Transparency = 1
  2210. GunHolePart.CanCollide = false
  2211. GunHolePart.Locked = true
  2212. GunHolePart.BrickColor = BRICKC("Medium stone grey")
  2213. GunHolePart.Position = Torso.Position
  2214. GunHolePart.Size = VT(0, 0, 0)
  2215. GunHolePart:BreakJoints()
  2216. GunHolePart.Parent = WeaponFolder
  2217.  
  2218. local GunHoleMotor = IT("Motor")
  2219. GunHoleMotor.C0 = CF(0, 0.73, -3.1) * ANGLES(RAD(0), RAD(0), RAD(0))
  2220. GunHoleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  2221. GunHoleMotor.Part0 = GunHandlePart
  2222. GunHoleMotor.Part1 = GunHolePart
  2223. GunHoleMotor.Parent = GunHandlePart
  2224.  
  2225. local GunShot = IT("Sound")
  2226. GunShot.Looped = false
  2227. GunShot.Volume = 1
  2228. GunShot.Pitch = 1
  2229. GunShot.SoundId = "rbxassetid://10209842" --10209798, 2920959, 10209859
  2230. GunShot.Parent = GunHolePart
  2231.  
  2232. -- 273794772 = Gun Holster/Unholster
  2233.  
  2234. local GunUnholster = IT("Sound")
  2235. GunUnholster.Looped = false
  2236. GunUnholster.Volume = 1
  2237. GunUnholster.Pitch = 1
  2238. GunUnholster.SoundId = "rbxassetid://204223703" --609342351
  2239. GunUnholster.Parent = GunHandlePart
  2240.  
  2241. local GunHolster = IT("Sound")
  2242. GunHolster.Looped = false
  2243. GunHolster.Volume = 1
  2244. GunHolster.Pitch = 1
  2245. GunHolster.SoundId = "rbxassetid://204223703" --656142612, 1567552075, 202243557, 342864661, 204223703, 1244559077
  2246. GunHolster.Parent = GunHandlePart
  2247.  
  2248. local GunReload = IT("Sound")
  2249. GunReload.Looped = false
  2250. GunReload.Volume = 1
  2251. GunReload.Pitch = 1
  2252. GunReload.SoundId = "rbxassetid://10209834" --10209801, 2920960, 10209869, 2691591
  2253. GunReload.Parent = GunHandlePart
  2254.  
  2255. local GunChamberBack = IT("Sound")
  2256. GunChamberBack.Looped = false
  2257. GunChamberBack.Volume = 1
  2258. GunChamberBack.Pitch = 1
  2259. GunChamberBack.SoundId = "rbxassetid://363762296" --299287260 short version, 268377170 longer version
  2260. GunChamberBack.Parent = GunHandlePart
  2261.  
  2262. local GunChamberForward = IT("Sound")
  2263. GunChamberForward.Looped = false
  2264. GunChamberForward.Volume = 1
  2265. GunChamberForward.Pitch = 1
  2266. GunChamberForward.SoundId = "rbxassetid://364490777"
  2267. GunChamberForward.Parent = GunHandlePart
  2268.  
  2269. local GunSmoke = IT("ParticleEmitter")
  2270. GunSmoke.Enabled = false
  2271. GunSmoke.Texture = "rbxassetid://528256032"
  2272. GunSmoke.Size = NUMSEQ(
  2273. {
  2274. NUMSEQKEYP(
  2275. 0, 0.1, 0.05
  2276. ),
  2277. NUMSEQKEYP(
  2278. 1, 0.1, 0.05
  2279. )
  2280. }
  2281. )
  2282. GunSmoke.Transparency = NUMSEQ(
  2283. {
  2284. NUMSEQKEYP(
  2285. 0, 0.9, 0
  2286. ),
  2287. NUMSEQKEYP(
  2288. 1, 1, 0
  2289. )
  2290. }
  2291. )
  2292. GunSmoke.Color = COLORSEQ(
  2293. {
  2294. COLORSEQKEYP(
  2295. 0, C3(255 / 255, 255 / 255, 255 / 255)
  2296. ),
  2297. COLORSEQKEYP(
  2298. 1, C3(255 / 255, 255 / 255, 255 / 255)
  2299. )
  2300. }
  2301. )
  2302. GunSmoke.VelocitySpread = 360
  2303. GunSmoke.Lifetime = NUMRANGE(1, 1)
  2304. GunSmoke.Speed = NUMRANGE(0.5, 0.5)
  2305. GunSmoke.Acceleration = VT(0, 2 * 5, 0)
  2306. GunSmoke.Drag = 10
  2307. GunSmoke.VelocityInheritance = 1
  2308. GunSmoke.Rate = 1000
  2309. GunSmoke.LightInfluence = 1
  2310. GunSmoke.LightEmission = 0
  2311. GunSmoke.ZOffset = 0.1
  2312. GunSmoke.EmissionDirection = "Top"
  2313. GunSmoke.Rotation = NUMRANGE(-360, 360)
  2314. GunSmoke.RotSpeed = NUMRANGE(-10, 10)
  2315. GunSmoke.LockedToPart = false
  2316. GunSmoke.Parent = GunHolePart
  2317.  
  2318. local GunShotEffect = IT("ParticleEmitter")
  2319. GunShotEffect.Enabled = false
  2320. GunShotEffect.Texture = "rbxassetid://243728166"
  2321. GunShotEffect.Size = NUMSEQ(
  2322. {
  2323. NUMSEQKEYP(
  2324. 0, 1, 0
  2325. ),
  2326. NUMSEQKEYP(
  2327. 1, 1, 0
  2328. )
  2329. }
  2330. )
  2331. GunShotEffect.Transparency = NUMSEQ(
  2332. {
  2333. NUMSEQKEYP(
  2334. 0, 0
  2335. ),
  2336. NUMSEQKEYP(
  2337. 1, 1
  2338. )
  2339. }
  2340. )
  2341. GunShotEffect.Color = COLORSEQ(
  2342. {
  2343. COLORSEQKEYP(
  2344. 0, C3(255 / 255, 170 / 255, 128 / 255)
  2345. ),
  2346. COLORSEQKEYP(
  2347. 1, C3(255 / 255, 170 / 255, 128 / 255)
  2348. )
  2349. }
  2350. )
  2351. GunShotEffect.VelocitySpread = 0
  2352. GunShotEffect.Lifetime = NUMRANGE(0.06, 0.06)
  2353. GunShotEffect.Speed = NUMRANGE(0, 0)
  2354. GunShotEffect.Acceleration = VT(0, 0, 0)
  2355. GunShotEffect.Drag = 0
  2356. GunShotEffect.VelocityInheritance = 0
  2357. GunShotEffect.Rate = 0
  2358. GunShotEffect.LightInfluence = 0
  2359. GunShotEffect.LightEmission = 1
  2360. GunShotEffect.ZOffset = 0.1
  2361. GunShotEffect.EmissionDirection = "Top"
  2362. GunShotEffect.Rotation = NUMRANGE(-360, 360)
  2363. GunShotEffect.RotSpeed = NUMRANGE(0, 0)
  2364. GunShotEffect.LockedToPart = true
  2365. GunShotEffect.Parent = GunHolePart
  2366.  
  2367. local GunLight = IT("PointLight")
  2368. GunLight.Enabled = true
  2369. GunLight.Brightness = 1000
  2370. GunLight.Color = C3(255 / 255, 170 / 255, 128 / 255)
  2371. GunLight.Shadows = true
  2372. GunLight.Range = 0
  2373. GunLight.Parent = GunHolePart
  2374.  
  2375. local FakeRightShoulder = IT("Weld")
  2376. FakeRightShoulder.Name = "Right Shoulder"
  2377. FakeRightShoulder.Part0 = Torso
  2378. FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  2379. FakeRightShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  2380. FakeRightShoulder.Part1 = RightArm
  2381.  
  2382. local FakeLeftShoulder = IT("Weld")
  2383. FakeLeftShoulder.Name = "Right Shoulder"
  2384. FakeLeftShoulder.Part0 = Torso
  2385. FakeLeftShoulder.C0 = CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  2386. FakeLeftShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  2387. FakeLeftShoulder.Part1 = LeftArm
  2388.  
  2389. WeaponFolder.Parent = Character
  2390.  
  2391. local function Clerp(INSTANCE, COORDINATE, TIME)
  2392. return INSTANCE:lerp(COORDINATE, TIME)
  2393. end
  2394.  
  2395. local function RenderWait(TIME)
  2396. if TIME == nil or TIME == 0 then
  2397. game:GetService("RunService").Heartbeat:wait()
  2398. else
  2399. for i = 1, TIME do
  2400. game:GetService("RunService").Heartbeat:wait()
  2401. end
  2402. end
  2403. end
  2404.  
  2405. local function EquipState(CURRENTSTATE)
  2406. GUNSTANCE = true
  2407. if CURRENTSTATE == true then
  2408. RightShoulder.Parent = nil
  2409. LeftShoulder.Parent = nil
  2410. FakeRightShoulder.Parent = Torso
  2411. FakeLeftShoulder.Parent = Torso
  2412. for i = 0, 1, 0.05 do
  2413. RenderWait()
  2414. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
  2415. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
  2416. end
  2417. GUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
  2418. GunHandleMotor.Part0 = RightArm
  2419. GunHandleMotor.C0 = GUNHANDLEOFFSET
  2420. Spawn(function()
  2421. RenderWait()
  2422. GunUnholster:Play()
  2423. end)
  2424. for i = 0, 1, 0.05 do
  2425. RenderWait()
  2426. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45 + 135 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
  2427. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(35 + 10 * i), RAD(0), RAD(-35 - 10 * i)) * ANGLES(RAD(0), RAD(35 + 10 * i), RAD(0)), i)
  2428. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
  2429. end
  2430. for i = 0, 1, 0.05 do
  2431. RenderWait()
  2432. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.4, 0.8) * ANGLES(RAD(135 - 45 * i), RAD(0), RAD(45 - 75 * i)), i)
  2433. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.4, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(89 + 1 * i), RAD(0)), i)
  2434. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0 - 30 * i), RAD(0)), i)
  2435. end
  2436. for i = 0, 1, 0.05 do
  2437. RenderWait()
  2438. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.8) * ANGLES(RAD(80 + 10 * i), RAD(0), RAD(-30)), i)
  2439. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  2440. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  2441. end
  2442. FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
  2443. FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
  2444. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
  2445. else
  2446. for i = 0, 1, 0.05 do
  2447. RenderWait()
  2448. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(45 - 90 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
  2449. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(45 - 10 * i), RAD(0), RAD(-45 + 10 * i)) * ANGLES(RAD(0), RAD(45 - 10 * i), RAD(0)), i)
  2450. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
  2451. end
  2452. Spawn(function()
  2453. RenderWait()
  2454. GunHolster:Play()
  2455. end)
  2456. for i = 0, 1, 0.05 do
  2457. RenderWait()
  2458. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
  2459. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
  2460. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, GUNHANDLEOFFSET, i)
  2461. end
  2462. GUNHANDLEOFFSET = Torso.CFrame:toObjectSpace(GunHandlePart.CFrame)
  2463. GunHandleMotor.Part0 = Torso
  2464. GunHandleMotor.C0 = GUNHANDLEOFFSET
  2465. for i = 0, 1, 0.05 do
  2466. RenderWait()
  2467. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(1 - 1 * i), RAD(0)), i)
  2468. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
  2469. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0)), i)
  2470. end
  2471. FakeRightShoulder.Parent = nil
  2472. FakeLeftShoulder.Parent = nil
  2473. RightShoulder.Parent = Torso
  2474. LeftShoulder.Parent = Torso
  2475. GunHandleMotor.C0 = CF(0.5, 0, 0.55) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
  2476. end
  2477. GUNSTANCE = false
  2478. end
  2479.  
  2480. local function BulletHole(POSITION, EFFECTCOLOR)
  2481. local BulletHolePart = IT("Part")
  2482. BulletHolePart.Anchored = true
  2483. BulletHolePart.FormFactor = "Custom"
  2484. BulletHolePart.TopSurface, BulletHolePart.BottomSurface, BulletHolePart.RightSurface, BulletHolePart.LeftSurface, BulletHolePart.FrontSurface, BulletHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  2485. BulletHolePart.Name = "Bullet Hole"
  2486. BulletHolePart.Material = "Plastic"
  2487. BulletHolePart.Reflectance = 0
  2488. BulletHolePart.Transparency = 1
  2489. BulletHolePart.CanCollide = false
  2490. BulletHolePart.Locked = true
  2491. BulletHolePart.BrickColor = BRICKC("Medium stone grey")
  2492. BulletHolePart.Size = VT(0.2, 0, 0.2)
  2493. BulletHolePart:BreakJoints()
  2494. BulletHolePart.CFrame = POSITION
  2495. BulletHolePart.Parent = EffectsFolder
  2496. game:GetService("Debris"):AddItem(BulletHolePart, 2)
  2497. local BulletHoleDecal = IT("Decal")
  2498. BulletHoleDecal.Color3 = C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  2499. BulletHoleDecal.Face = "Top"
  2500. BulletHoleDecal.Texture = "rbxassetid://359667865"
  2501. BulletHoleDecal.Transparency = 0
  2502. BulletHoleDecal.Parent = BulletHolePart
  2503. local BulletHoleSound = IT("Sound")
  2504. BulletHoleSound.Looped = false
  2505. BulletHoleSound.Volume = 1
  2506. BulletHoleSound.Pitch = MRANDOM(80, 120) / 100
  2507. BulletHoleSound.SoundId = "rbxassetid://"..BulletImpactSounds[13]
  2508. BulletHoleSound.Parent = BulletHolePart
  2509. local BulletHoleSound2 = IT("Sound")
  2510. BulletHoleSound2.Looped = false
  2511. BulletHoleSound2.Volume = 1
  2512. BulletHoleSound2.Pitch = MRANDOM(80, 120) / 100
  2513. BulletHoleSound2.SoundId = "rbxassetid://196864064"
  2514. BulletHoleSound2.Parent = BulletHolePart
  2515. local BulletImpactEffect = IT("ParticleEmitter")
  2516. BulletImpactEffect.Enabled = false
  2517. BulletImpactEffect.Texture = "rbxassetid://241685484"
  2518. BulletImpactEffect.Size = NUMSEQ(
  2519. {
  2520. NUMSEQKEYP(
  2521. 0, 0.05, 0.025
  2522. ),
  2523. NUMSEQKEYP(
  2524. 1, 0.05, 0.025
  2525. )
  2526. }
  2527. )
  2528. BulletImpactEffect.Transparency = NUMSEQ(
  2529. {
  2530. NUMSEQKEYP(
  2531. 0, 0, 0
  2532. ),
  2533. NUMSEQKEYP(
  2534. 1, 1, 0
  2535. )
  2536. }
  2537. )
  2538. BulletImpactEffect.Color = COLORSEQ(
  2539. {
  2540. COLORSEQKEYP(
  2541. 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  2542. ),
  2543. COLORSEQKEYP(
  2544. 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
  2545. )
  2546. }
  2547. )
  2548. BulletImpactEffect.VelocitySpread = 45
  2549. BulletImpactEffect.Lifetime = NUMRANGE(0.2, 0.2)
  2550. BulletImpactEffect.Speed = NUMRANGE(30, 30)
  2551. BulletImpactEffect.Acceleration = VT(0, -196.2, 0)
  2552. BulletImpactEffect.Drag = 0
  2553. BulletImpactEffect.VelocityInheritance = 0
  2554. BulletImpactEffect.Rate = 0
  2555. BulletImpactEffect.LightInfluence = 1
  2556. BulletImpactEffect.LightEmission = 0
  2557. BulletImpactEffect.ZOffset = 0
  2558. BulletImpactEffect.EmissionDirection = "Top"
  2559. BulletImpactEffect.Rotation = NUMRANGE(-360, 360)
  2560. BulletImpactEffect.RotSpeed = NUMRANGE(-360, 360)
  2561. BulletImpactEffect.LockedToPart = false
  2562. BulletImpactEffect.Parent = BulletHolePart
  2563. local BulletImpactEffect2 = IT("ParticleEmitter")
  2564. BulletImpactEffect2.Enabled = false
  2565. BulletImpactEffect2.Texture = "rbxassetid://709137722"
  2566. BulletImpactEffect2.Size = NUMSEQ(
  2567. {
  2568. NUMSEQKEYP(
  2569. 0, 0.5, 0
  2570. ),
  2571. NUMSEQKEYP(
  2572. 1, 0.5, 0
  2573. )
  2574. }
  2575. )
  2576. BulletImpactEffect2.Transparency = NUMSEQ(
  2577. {
  2578. NUMSEQKEYP(
  2579. 0, 0, 0
  2580. ),
  2581. NUMSEQKEYP(
  2582. 1, 1, 0
  2583. )
  2584. }
  2585. )
  2586. BulletImpactEffect2.Color = COLORSEQ(
  2587. {
  2588. COLORSEQKEYP(
  2589. 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  2590. ),
  2591. COLORSEQKEYP(
  2592. 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
  2593. )
  2594. }
  2595. )
  2596. BulletImpactEffect2.VelocitySpread = 10
  2597. BulletImpactEffect2.Lifetime = NUMRANGE(0.2, 0.2)
  2598. BulletImpactEffect2.Speed = NUMRANGE(2, 2)
  2599. BulletImpactEffect2.Acceleration = VT(0, 0, 0)
  2600. BulletImpactEffect2.Drag = 0
  2601. BulletImpactEffect2.VelocityInheritance = 0
  2602. BulletImpactEffect2.Rate = 0
  2603. BulletImpactEffect2.LightInfluence = 1
  2604. BulletImpactEffect2.LightEmission = 0
  2605. BulletImpactEffect2.ZOffset = 0.4
  2606. BulletImpactEffect2.EmissionDirection = "Top"
  2607. BulletImpactEffect2.Rotation = NUMRANGE(-360, 360)
  2608. BulletImpactEffect2.RotSpeed = NUMRANGE(-360, 360)
  2609. BulletImpactEffect2.LockedToPart = false
  2610. BulletImpactEffect2.Parent = BulletHolePart
  2611. Spawn(function()
  2612. RenderWait()
  2613. BulletImpactEffect:Emit(MRANDOM(5, 15))
  2614. BulletImpactEffect2:Emit(MRANDOM(1, 1))
  2615. BulletHoleSound:Play()
  2616. BulletHoleSound2:Play()
  2617. end)
  2618. end
  2619.  
  2620. local function FakeBullet(POSITION, VELOCITY)
  2621. local FakeBulletPart = IT("Part")
  2622. FakeBulletPart.Anchored = false
  2623. FakeBulletPart.FormFactor = "Custom"
  2624. FakeBulletPart.TopSurface, FakeBulletPart.BottomSurface, FakeBulletPart.RightSurface, FakeBulletPart.LeftSurface, FakeBulletPart.FrontSurface, FakeBulletPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  2625. FakeBulletPart.Name = "Bullet Shell"
  2626. FakeBulletPart.Material = "Plastic"
  2627. FakeBulletPart.Reflectance = 0
  2628. FakeBulletPart.Transparency = 0
  2629. FakeBulletPart.CanCollide = true
  2630. FakeBulletPart.Locked = true
  2631. FakeBulletPart.BrickColor = BRICKC("Bright red")
  2632. FakeBulletPart.Size = VT(0.22, 0.12, 0.12)
  2633. FakeBulletPart:BreakJoints()
  2634. FakeBulletPart.CFrame = POSITION
  2635. local FakeBulletMesh = IT("SpecialMesh")
  2636. FakeBulletMesh.MeshType = "Cylinder"
  2637. FakeBulletMesh.MeshId = ""
  2638. FakeBulletMesh.TextureId = ""
  2639. FakeBulletMesh.Offset = VT(0, 0, 0)
  2640. FakeBulletMesh.Scale = VT(1, 1, 1)
  2641. FakeBulletMesh.Parent = FakeBulletPart
  2642. FakeBulletPart.Parent = EffectsFolder
  2643. FakeBulletPart.Velocity = VELOCITY
  2644. game:GetService("Debris"):AddItem(FakeBulletPart, 3)
  2645. --[[
  2646. local BulletContact = IT("Sound")
  2647. BulletContact.Looped = false
  2648. BulletContact.Volume = 0.5
  2649. BulletContact.Pitch = 1
  2650. BulletContact.SoundId = "rbxassetid://"..BulletShellImpactSounds[5]
  2651. BulletContact.Parent = FakeBulletPart
  2652. local HITSOMETHING = false
  2653. FakeBulletPart.Touched:connect(function()
  2654. if HITSOMETHING == false then
  2655. HITSOMETHING = true
  2656. Spawn(function()
  2657. RenderWait()
  2658. BulletContact:Play()
  2659. end)
  2660. end
  2661. end)
  2662. --]]
  2663. end
  2664.  
  2665. local function FakeClip(POSITION, VELOCITY)
  2666. local FakeClipPart = IT("Part")
  2667. FakeClipPart.Anchored = false
  2668. FakeClipPart.FormFactor = "Custom"
  2669. FakeClipPart.TopSurface, FakeClipPart.BottomSurface, FakeClipPart.RightSurface, FakeClipPart.LeftSurface, FakeClipPart.FrontSurface, FakeClipPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  2670. FakeClipPart.Name = "Clip"
  2671. FakeClipPart.Material = "Plastic"
  2672. FakeClipPart.Reflectance = 0
  2673. FakeClipPart.Transparency = 0
  2674. FakeClipPart.CanCollide = true
  2675. FakeClipPart.Locked = true
  2676. FakeClipPart.BrickColor = BRICKC("Black")
  2677. FakeClipPart.Size = VT(0.08, 0.8, 0.3)
  2678. FakeClipPart:BreakJoints()
  2679. FakeClipPart.CFrame = POSITION
  2680. FakeClipPart.Parent = EffectsFolder
  2681. FakeClipPart.Velocity = VELOCITY
  2682. game:GetService("Debris"):AddItem(FakeClipPart, 3)
  2683. end
  2684.  
  2685. local function ShootGun()
  2686. GUNSTANCE = true
  2687. local HITHUMANOID = nil
  2688. spawn(function()
  2689. RenderWait()
  2690. GunShot.Pitch = MRANDOM(90, 110) / 100
  2691. GunShot:Play()
  2692. end)
  2693. GunShotEffect:Emit(MRANDOM(4, 6))
  2694. GunLight.Range = 8
  2695. BULLETCOUNT = BULLETCOUNT - 1
  2696. for i = 1, 9 do
  2697. local GUNSPREAD = VT(MRANDOM(-2000, 2000) / 100, MRANDOM(-2000, 2000) / 100, MRANDOM(-2000, 2000) / 100) * ((GunHolePart.Position - Mouse.Hit.p).magnitude / 100)
  2698. local GUNRAY = Ray.new(GunHolePart.Position, (CF(GunHolePart.Position, Mouse.Hit.p + GUNSPREAD).lookVector).unit * 1000)
  2699. local GUNRAYHIT, GUNRAYPOSITION, GUNRAYANGLE = game:GetService("Workspace"):FindPartOnRay(GUNRAY, Character)
  2700. if GUNRAYHIT ~= nil then
  2701. if GUNRAYHIT.Parent:FindFirstChild("Humanoid") then
  2702. HITHUMANOID = GUNRAYHIT.Parent:FindFirstChild("Humanoid")
  2703. else
  2704. if GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid") then
  2705. HITHUMANOID = GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid")
  2706. end
  2707. end
  2708. if HITHUMANOID ~= nil and HITHUMANOID.Parent ~= Character then
  2709. HITHUMANOID.Health = HITHUMANOID.Health - (HITHUMANOID.MaxHealth * 0.3)
  2710. else
  2711. BulletHole(CF(GUNRAYPOSITION, GUNRAYPOSITION - GUNRAYANGLE) * ANGLES(RAD(90), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(MRANDOM(-360, 360)), RAD(0)), GUNRAYHIT.BrickColor)
  2712. end
  2713. end
  2714. end
  2715. SMOKETIME = 2
  2716. for i = 0, 1, 0.08 do
  2717. RenderWait()
  2718. GunLight.Range = 8 - (8 * i)
  2719. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 1) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  2720. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.3) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  2721. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  2722. end
  2723. Spawn(function()
  2724. RenderWait()
  2725. GunChamberBack:Play()
  2726. wait(1 * 0.008)
  2727. GunChamberForward:Play()
  2728. end)
  2729. GunLight.Range = 0
  2730. FakeBullet(GunHandlePart.CFrame * CF(0, 0.75, -0.6) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20))), (GunHandlePart.CFrame * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(30), RAD(0), RAD(0))).lookVector * 20)
  2731. for i = 0, 1, 0.08 do
  2732. RenderWait()
  2733. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  2734. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -0.8 - 0.7 * i) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  2735. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  2736. end
  2737. FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
  2738. FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
  2739. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
  2740. GUNSTANCE = false
  2741. end
  2742.  
  2743. local function ReloadGun()
  2744. GUNSTANCE = true
  2745. MOUSEDOWN = false
  2746. MOUSEDOWN2 = false
  2747. if BULLETCOUNT <= 0 then
  2748. CHAMBEREMPTY = true
  2749. end
  2750. while MOUSEDOWN2 ~= true and BULLETCOUNT < MAXBULLETS do
  2751. for i = 0, 1, 0.06 do
  2752. RenderWait()
  2753. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(110 + 10 * i), RAD(0), RAD(-30)), i)
  2754. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
  2755. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  2756. if MOUSEDOWN == true then
  2757. MOUSEDOWN2 = true
  2758. end
  2759. end
  2760. Spawn(function()
  2761. RenderWait()
  2762. GunReload:Play()
  2763. end)
  2764. --FakeClip(GunHandlePart.CFrame * CF(0, 0, -0.67) * ANGLES(RAD(30), RAD(0), RAD(0)), (GunHandlePart.CFrame * ANGLES(RAD(-90), RAD(0), RAD(0))).lookVector * 10)
  2765. for i = 0, 1, 0.06 do
  2766. RenderWait()
  2767. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(130 - 10 * i), RAD(0), RAD(-30)), i)
  2768. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(40 - 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1 - 0.3 * i) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(59 + 1 * i), RAD(0)), i)
  2769. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  2770. if MOUSEDOWN == true then
  2771. MOUSEDOWN2 = true
  2772. end
  2773. end
  2774. if BULLETCOUNT < MAXBULLETS then
  2775. BULLETCOUNT = BULLETCOUNT + 1
  2776. else
  2777. BULLETCOUNT = MAXBULLETS
  2778. end
  2779. if MOUSEDOWN2 == true or BULLETCOUNT >= MAXBULLETS then
  2780. break
  2781. end
  2782. end
  2783. for i = 0, 1, 0.08 do
  2784. RenderWait()
  2785. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.8) * ANGLES(RAD(80 + 10 * i), RAD(0), RAD(-30)), i)
  2786. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  2787. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  2788. end
  2789. if BULLETCOUNT > 0 then
  2790. GunReload:Stop()
  2791. end
  2792. if CHAMBEREMPTY == true then
  2793. CHAMBEREMPTY = false
  2794. Spawn(function()
  2795. RenderWait()
  2796. GunChamberBack:Play()
  2797. wait(1 * 0.008)
  2798. GunChamberForward:Play()
  2799. end)
  2800. for i = 0, 1, 0.08 do
  2801. RenderWait()
  2802. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  2803. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -0.8 - 0.7 * i) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  2804. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  2805. end
  2806. end
  2807. FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
  2808. FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
  2809. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
  2810. MOUSEDOWN2 = false
  2811. GUNSTANCE = false
  2812. end
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818. --//=================================\\
  2819. --|| SET THINGS UP
  2820. --\\=================================//
  2821.  
  2822. Mouse.Button1Down:connect(function()
  2823. MOUSEDOWN = true
  2824. if GUNSTANCE == false and EQUIPPED == true then
  2825. if BULLETCOUNT > 0 then
  2826. ShootGun()
  2827. elseif BULLETCOUNT <= 0 then
  2828. ReloadGun()
  2829. end
  2830. end
  2831. end)
  2832.  
  2833. Mouse.Button1Up:connect(function()
  2834. MOUSEDOWN = false
  2835. end)
  2836.  
  2837. Mouse.KeyDown:connect(function(KEY)
  2838. if KEY == "t" and GUNSTANCE == false then
  2839. if EQUIPPED == false then
  2840. EQUIPPED = true
  2841. else
  2842. EQUIPPED = false
  2843. end
  2844. EquipState(EQUIPPED)
  2845. end
  2846. if KEY == "r" and GUNSTANCE == false and EQUIPPED == true and BULLETCOUNT < MAXBULLETS then
  2847. ReloadGun()
  2848. end
  2849. end)
  2850.  
  2851.  
  2852.  
  2853.  
  2854.  
  2855.  
  2856. --//=================================\\
  2857. --|| WRAP THE WHOLE SCRIPT UP
  2858. --\\=================================//
  2859.  
  2860. while true do
  2861. RenderWait()
  2862. SMOKETIME = SMOKETIME - (1 / 30) / 2
  2863. if SMOKETIME <= 0 then
  2864. if GunSmoke.Enabled == true then
  2865. GunSmoke.Enabled = false
  2866. end
  2867. else
  2868. if GunSmoke.Enabled == false then
  2869. GunSmoke.Enabled = true
  2870. end
  2871. end
  2872. end
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878. --//====================================================\\--
  2879. --|| END OF SCRIPT
  2880. --\\====================================================//--
  2881. end))
  2882. Script3.Name = "sniper"
  2883. Script3.Parent = mas
  2884. table.insert(cors,sandbox(Script3,function()
  2885. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2886. local Player,game,owner = owner,game
  2887. local RealPlayer = Player
  2888. do
  2889. --print("FE Compatibility code V2 by Mokiros")
  2890. local RealPlayer = RealPlayer
  2891. script.Parent = RealPlayer.Character
  2892.  
  2893. --Fake event to make stuff like Mouse.KeyDown work
  2894. local Disconnect_Function = function(this)
  2895. this[1].Functions[this[2]] = nil
  2896. end
  2897. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  2898. local FakeEvent_Metatable = {__index={
  2899. Connect = function(this,f)
  2900. local i = tostring(math.random(0,10000))
  2901. while this.Functions[i] do
  2902. i = tostring(math.random(0,10000))
  2903. end
  2904. this.Functions[i] = f
  2905. return setmetatable({this,i},Disconnect_Metatable)
  2906. end
  2907. }}
  2908. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  2909. local function fakeEvent()
  2910. return setmetatable({Functions={}},FakeEvent_Metatable)
  2911. end
  2912.  
  2913. --Creating fake input objects with fake variables
  2914. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  2915. FakeMouse.keyUp = FakeMouse.KeyUp
  2916. FakeMouse.keyDown = FakeMouse.KeyDown
  2917. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  2918. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  2919. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  2920. end}
  2921. --Merged 2 functions into one by checking amount of arguments
  2922. CAS.UnbindAction = CAS.BindAction
  2923.  
  2924. --This function will trigger the events that have been :Connect()'ed
  2925. local function TriggerEvent(self,ev,...)
  2926. for _,f in pairs(self[ev].Functions) do
  2927. f(...)
  2928. end
  2929. end
  2930. FakeMouse.TriggerEvent = TriggerEvent
  2931. UIS.TriggerEvent = TriggerEvent
  2932.  
  2933. --Client communication
  2934. local Event = Instance.new("RemoteEvent")
  2935. Event.Name = "UserInput_Event"
  2936. Event.OnServerEvent:Connect(function(plr,io)
  2937. if plr~=RealPlayer then return end
  2938. FakeMouse.Target = io.Target
  2939. FakeMouse.Hit = io.Hit
  2940. if not io.isMouse then
  2941. local b = io.UserInputState == Enum.UserInputState.Begin
  2942. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  2943. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  2944. end
  2945. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  2946. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  2947. end
  2948. for _,t in pairs(CAS.Actions) do
  2949. for _,k in pairs(t.Keys) do
  2950. if k==io.KeyCode then
  2951. t.Function(t.Name,io.UserInputState,io)
  2952. end
  2953. end
  2954. end
  2955. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  2956. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  2957. end
  2958. end)
  2959. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  2960. local Mouse = owner:GetMouse()
  2961. local UIS = game:GetService("UserInputService")
  2962. local input = function(io,RobloxHandled)
  2963. if RobloxHandled then return end
  2964. --Since InputObject is a client-side instance, we create and pass table instead
  2965. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  2966. end
  2967. UIS.InputBegan:Connect(input)
  2968. UIS.InputEnded:Connect(input)
  2969. local h,t
  2970. --Give the server mouse data every second frame, but only if the values changed
  2971. --If player is not moving their mouse, client won't fire events
  2972. local HB = game:GetService("RunService").Heartbeat
  2973. while true do
  2974. if h~=Mouse.Hit or t~=Mouse.Target then
  2975. h,t=Mouse.Hit,Mouse.Target
  2976. Event:FireServer({isMouse=true,Target=t,Hit=h})
  2977. end
  2978. --Wait 2 frames
  2979. for i=1,2 do
  2980. HB:Wait()
  2981. end
  2982. end]==],script)
  2983.  
  2984. ----Sandboxed game object that allows the usage of client-side methods and services
  2985. --Real game object
  2986. local RealGame = game
  2987.  
  2988. --Metatable for fake service
  2989. local FakeService_Metatable = {
  2990. __index = function(self,k)
  2991. local s = rawget(self,"_RealService")
  2992. if s then
  2993. return typeof(s[k])=="function"
  2994. and function(_,...)return s[k](s,...)end or s[k]
  2995. end
  2996. end,
  2997. __newindex = function(self,k,v)
  2998. local s = rawget(self,"_RealService")
  2999. if s then s[k]=v end
  3000. end
  3001. }
  3002. local function FakeService(t,RealService)
  3003. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  3004. return setmetatable(t,FakeService_Metatable)
  3005. end
  3006.  
  3007. --Fake game object
  3008. local FakeGame = {
  3009. GetService = function(self,s)
  3010. return rawget(self,s) or RealGame:GetService(s)
  3011. end,
  3012. Players = FakeService({
  3013. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  3014. },"Players"),
  3015. UserInputService = FakeService(UIS,"UserInputService"),
  3016. ContextActionService = FakeService(CAS,"ContextActionService"),
  3017. RunService = FakeService({
  3018. _btrs = {},
  3019. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  3020. BindToRenderStep = function(self,name,_,fun)
  3021. self._btrs[name] = self.Heartbeat:Connect(fun)
  3022. end,
  3023. UnbindFromRenderStep = function(self,name)
  3024. self._btrs[name]:Disconnect()
  3025. end,
  3026. },"RunService")
  3027. }
  3028. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  3029. FakeGame.service = FakeGame.GetService
  3030. FakeService(FakeGame,game)
  3031. --Changing owner to fake player object to support owner:GetMouse()
  3032. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  3033. end
  3034.  
  3035. --//====================================================\\--
  3036. --|| CREATED BY BRANNON1964802
  3037. --\\====================================================//--
  3038.  
  3039.  
  3040.  
  3041. wait(1 / 60)
  3042.  
  3043.  
  3044.  
  3045. Player = game:GetService("Players").LocalPlayer
  3046. PlayerGui = Player.PlayerGui
  3047. Cam = workspace.CurrentCamera
  3048. Backpack = Player.Backpack
  3049. Character = Player.Character
  3050. Humanoid = Character.Humanoid
  3051. Mouse = Player:GetMouse()
  3052. RootPart = Character["HumanoidRootPart"]
  3053. Torso = Character["Torso"]
  3054. Head = Character["Head"]
  3055. Face = Head.face
  3056. RightArm = Character["Right Arm"]
  3057. LeftArm = Character["Left Arm"]
  3058. RightLeg = Character["Right Leg"]
  3059. LeftLeg = Character["Left Leg"]
  3060. RootJoint = RootPart["RootJoint"]
  3061. Neck = Torso["Neck"]
  3062. RightShoulder = Torso["Right Shoulder"]
  3063. LeftShoulder = Torso["Left Shoulder"]
  3064. RightHip = Torso["Right Hip"]
  3065. LeftHip = Torso["Left Hip"]
  3066.  
  3067. IT = Instance.new
  3068. CF = CFrame.new
  3069. VT = Vector3.new
  3070. RAD = math.rad
  3071. C3 = Color3.new
  3072. UD2 = UDim2.new
  3073. BRICKC = BrickColor.new
  3074. ANGLES = CFrame.Angles
  3075. EULER = CFrame.fromEulerAnglesXYZ
  3076. COS = math.cos
  3077. ACOS = math.acos
  3078. SIN = math.sin
  3079. ASIN = math.asin
  3080. ABS = math.abs
  3081. ATAN = math.atan
  3082. SIGN = math.sign
  3083. FREXP = math.frexp
  3084. MRANDOM = math.random
  3085. FLOOR = math.floor
  3086. MHUGE = math.huge
  3087. NUMSEQ = NumberSequence.new
  3088. NUMSEQKEYP = NumberSequenceKeypoint.new
  3089. NUMRANGE = NumberRange.new
  3090. COLORSEQ = ColorSequence.new
  3091. COLORSEQKEYP = ColorSequenceKeypoint.new
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097. --//=================================\\
  3098. --|| USEFUL VALUES
  3099. --\\=================================//
  3100.  
  3101. local EQUIPPED = false
  3102. local GUNSTANCE = false
  3103. local CHAMBEREMPTY = false
  3104. local SMOKETIME = 0
  3105. local GUNHANDLEOFFSET = nil
  3106. local MAXBULLETS = 5
  3107. local BULLETCOUNT = MAXBULLETS
  3108. local BulletShellImpactSounds = {"1684805263", "1684805499", "1684805682", "1684805848", "1684806019", "1684806165", "1684806345", "1684806545"}
  3109. local BulletImpactSounds = {"525719118", "525719147", "525719186", "525719232", "525719348", "525719399", "525719421", "525720445", "525720464", "525720500", "525720527", "525720556", "525720625", "525720650"}
  3110.  
  3111.  
  3112.  
  3113.  
  3114.  
  3115. --//=================================\\
  3116. --||SOME FUNCTIONS AND WEAPON CREATION
  3117. --\\=================================//
  3118.  
  3119. local WeaponFolder = IT("Folder")
  3120. WeaponFolder.Name = "Weapon"
  3121. local EffectsFolder = workspace--[[IT("Folder")
  3122. EffectsFolder.Name = "Effects"
  3123. EffectsFolder.Parent = WeaponFolder--]]
  3124.  
  3125. local GunHandlePart = IT("Part")
  3126. GunHandlePart.Anchored = false
  3127. GunHandlePart.FormFactor = "Custom"
  3128. GunHandlePart.TopSurface, GunHandlePart.BottomSurface, GunHandlePart.RightSurface, GunHandlePart.LeftSurface, GunHandlePart.FrontSurface, GunHandlePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  3129. GunHandlePart.Name = "Gun Handle Part"
  3130. GunHandlePart.Material = "Plastic"
  3131. GunHandlePart.Reflectance = 0
  3132. GunHandlePart.Transparency = 0
  3133. GunHandlePart.CanCollide = false
  3134. GunHandlePart.Locked = true
  3135. GunHandlePart.BrickColor = BRICKC("Black")
  3136. GunHandlePart.Position = Torso.Position
  3137. GunHandlePart.Size = VT(0.2, 0.2, 0.2)
  3138. GunHandlePart:BreakJoints()
  3139. GunHandlePart.Parent = WeaponFolder
  3140.  
  3141. local GunHandleMesh = IT("SpecialMesh")
  3142. GunHandleMesh.MeshType = "FileMesh"
  3143. GunHandleMesh.MeshId = "rbxassetid://2761723"
  3144. GunHandleMesh.TextureId = ""
  3145. GunHandleMesh.Offset = VT(0, 0.4, -1.4)
  3146. GunHandleMesh.Scale = VT(0.6, 0.6, 0.6)
  3147. GunHandleMesh.Parent = GunHandlePart
  3148.  
  3149. local GunHandleMotor = IT("Motor")
  3150. GunHandleMotor.C0 = CF(1, 0.4, 0.7) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
  3151. GunHandleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  3152. GunHandleMotor.Part0 = Torso
  3153. GunHandleMotor.Part1 = GunHandlePart
  3154. GunHandleMotor.Parent = GunHandlePart
  3155.  
  3156. local GunHolePart = IT("Part")
  3157. GunHolePart.Anchored = false
  3158. GunHolePart.FormFactor = "Custom"
  3159. GunHolePart.TopSurface, GunHolePart.BottomSurface, GunHolePart.RightSurface, GunHolePart.LeftSurface, GunHolePart.FrontSurface, GunHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  3160. GunHolePart.Name = "Gun Hole Part"
  3161. GunHolePart.Material = "Plastic"
  3162. GunHolePart.Reflectance = 0
  3163. GunHolePart.Transparency = 1
  3164. GunHolePart.CanCollide = false
  3165. GunHolePart.Locked = true
  3166. GunHolePart.BrickColor = BRICKC("Medium stone grey")
  3167. GunHolePart.Position = Torso.Position
  3168. GunHolePart.Size = VT(0, 0, 0)
  3169. GunHolePart:BreakJoints()
  3170. GunHolePart.Parent = WeaponFolder
  3171.  
  3172. local GunHoleMotor = IT("Motor")
  3173. GunHoleMotor.C0 = CF(0.03, 0.55, -4.95) * ANGLES(RAD(0), RAD(0), RAD(0))
  3174. GunHoleMotor.C1 = CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  3175. GunHoleMotor.Part0 = GunHandlePart
  3176. GunHoleMotor.Part1 = GunHolePart
  3177. GunHoleMotor.Parent = GunHandlePart
  3178.  
  3179. local GunShot = IT("Sound")
  3180. GunShot.Looped = false
  3181. GunShot.Volume = 1
  3182. GunShot.Pitch = 1
  3183. GunShot.SoundId = "rbxassetid://492961938" --10209798, 2920959, 10209859
  3184. GunShot.Parent = GunHolePart
  3185.  
  3186. -- 273794772 = Gun Holster/Unholster
  3187.  
  3188. local GunUnholster = IT("Sound")
  3189. GunUnholster.Looped = false
  3190. GunUnholster.Volume = 1
  3191. GunUnholster.Pitch = 1
  3192. GunUnholster.SoundId = "rbxassetid://204223703" --609342351
  3193. GunUnholster.Parent = GunHandlePart
  3194.  
  3195. local GunHolster = IT("Sound")
  3196. GunHolster.Looped = false
  3197. GunHolster.Volume = 1
  3198. GunHolster.Pitch = 1
  3199. GunHolster.SoundId = "rbxassetid://204223703" --656142612, 1567552075, 202243557, 342864661, 204223703, 1244559077
  3200. GunHolster.Parent = GunHandlePart
  3201.  
  3202. local GunReload = IT("Sound")
  3203. GunReload.Looped = false
  3204. GunReload.Volume = 1
  3205. GunReload.Pitch = 0.6
  3206. GunReload.SoundId = "rbxassetid://10209834" --10209801, 2920960, 10209869, 2691591
  3207. GunReload.Parent = GunHandlePart
  3208.  
  3209. local GunChamberBack = IT("Sound")
  3210. GunChamberBack.Looped = false
  3211. GunChamberBack.Volume = 1
  3212. GunChamberBack.Pitch = 1.3
  3213. GunChamberBack.SoundId = "rbxassetid://363762296" --299287260 short version, 268377170 longer version
  3214. GunChamberBack.Parent = GunHandlePart
  3215.  
  3216. local GunChamberForward = IT("Sound")
  3217. GunChamberForward.Looped = false
  3218. GunChamberForward.Volume = 1
  3219. GunChamberForward.Pitch = 1.3
  3220. GunChamberForward.SoundId = "rbxassetid://364490777"
  3221. GunChamberForward.Parent = GunHandlePart
  3222.  
  3223. local GunSmoke = IT("ParticleEmitter")
  3224. GunSmoke.Enabled = false
  3225. GunSmoke.Texture = "rbxassetid://528256032"
  3226. GunSmoke.Size = NUMSEQ(
  3227. {
  3228. NUMSEQKEYP(
  3229. 0, 0.1, 0.05
  3230. ),
  3231. NUMSEQKEYP(
  3232. 1, 0.1, 0.05
  3233. )
  3234. }
  3235. )
  3236. GunSmoke.Transparency = NUMSEQ(
  3237. {
  3238. NUMSEQKEYP(
  3239. 0, 0.9, 0
  3240. ),
  3241. NUMSEQKEYP(
  3242. 1, 1, 0
  3243. )
  3244. }
  3245. )
  3246. GunSmoke.Color = COLORSEQ(
  3247. {
  3248. COLORSEQKEYP(
  3249. 0, C3(255 / 255, 255 / 255, 255 / 255)
  3250. ),
  3251. COLORSEQKEYP(
  3252. 1, C3(255 / 255, 255 / 255, 255 / 255)
  3253. )
  3254. }
  3255. )
  3256. GunSmoke.VelocitySpread = 360
  3257. GunSmoke.Lifetime = NUMRANGE(1, 1)
  3258. GunSmoke.Speed = NUMRANGE(0.5, 0.5)
  3259. GunSmoke.Acceleration = VT(0, 2 * 5, 0)
  3260. GunSmoke.Drag = 10
  3261. GunSmoke.VelocityInheritance = 1
  3262. GunSmoke.Rate = 1000
  3263. GunSmoke.LightInfluence = 1
  3264. GunSmoke.LightEmission = 0
  3265. GunSmoke.ZOffset = 0.1
  3266. GunSmoke.EmissionDirection = "Top"
  3267. GunSmoke.Rotation = NUMRANGE(-360, 360)
  3268. GunSmoke.RotSpeed = NUMRANGE(-10, 10)
  3269. GunSmoke.LockedToPart = false
  3270. GunSmoke.Parent = GunHolePart
  3271.  
  3272. local GunShotEffect = IT("ParticleEmitter")
  3273. GunShotEffect.Enabled = false
  3274. GunShotEffect.Texture = "rbxassetid://243728166"
  3275. GunShotEffect.Size = NUMSEQ(
  3276. {
  3277. NUMSEQKEYP(
  3278. 0, 1, 0
  3279. ),
  3280. NUMSEQKEYP(
  3281. 1, 1, 0
  3282. )
  3283. }
  3284. )
  3285. GunShotEffect.Transparency = NUMSEQ(
  3286. {
  3287. NUMSEQKEYP(
  3288. 0, 0
  3289. ),
  3290. NUMSEQKEYP(
  3291. 1, 1
  3292. )
  3293. }
  3294. )
  3295. GunShotEffect.Color = COLORSEQ(
  3296. {
  3297. COLORSEQKEYP(
  3298. 0, C3(255 / 255, 170 / 255, 128 / 255)
  3299. ),
  3300. COLORSEQKEYP(
  3301. 1, C3(255 / 255, 170 / 255, 128 / 255)
  3302. )
  3303. }
  3304. )
  3305. GunShotEffect.VelocitySpread = 0
  3306. GunShotEffect.Lifetime = NUMRANGE(0.06, 0.06)
  3307. GunShotEffect.Speed = NUMRANGE(0, 0)
  3308. GunShotEffect.Acceleration = VT(0, 0, 0)
  3309. GunShotEffect.Drag = 0
  3310. GunShotEffect.VelocityInheritance = 0
  3311. GunShotEffect.Rate = 0
  3312. GunShotEffect.LightInfluence = 0
  3313. GunShotEffect.LightEmission = 1
  3314. GunShotEffect.ZOffset = 0.1
  3315. GunShotEffect.EmissionDirection = "Top"
  3316. GunShotEffect.Rotation = NUMRANGE(-360, 360)
  3317. GunShotEffect.RotSpeed = NUMRANGE(0, 0)
  3318. GunShotEffect.LockedToPart = true
  3319. GunShotEffect.Parent = GunHolePart
  3320.  
  3321. local GunLight = IT("PointLight")
  3322. GunLight.Enabled = true
  3323. GunLight.Brightness = 1000
  3324. GunLight.Color = C3(255 / 255, 170 / 255, 128 / 255)
  3325. GunLight.Shadows = true
  3326. GunLight.Range = 0
  3327. GunLight.Parent = GunHolePart
  3328.  
  3329. local FakeRightShoulder = IT("Weld")
  3330. FakeRightShoulder.Name = "Right Shoulder"
  3331. FakeRightShoulder.Part0 = Torso
  3332. FakeRightShoulder.C0 = CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  3333. FakeRightShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  3334. FakeRightShoulder.Part1 = RightArm
  3335.  
  3336. local FakeLeftShoulder = IT("Weld")
  3337. FakeLeftShoulder.Name = "Right Shoulder"
  3338. FakeLeftShoulder.Part0 = Torso
  3339. FakeLeftShoulder.C0 = CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  3340. FakeLeftShoulder.C1 = CF(0, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0))
  3341. FakeLeftShoulder.Part1 = LeftArm
  3342.  
  3343. WeaponFolder.Parent = Character
  3344.  
  3345. local function Clerp(INSTANCE, COORDINATE, TIME)
  3346. return INSTANCE:lerp(COORDINATE, TIME)
  3347. end
  3348.  
  3349. local function RenderWait(TIME)
  3350. if TIME == nil or TIME == 0 then
  3351. game:GetService("RunService").Heartbeat:wait()
  3352. else
  3353. for i = 1, TIME do
  3354. game:GetService("RunService").Heartbeat:wait()
  3355. end
  3356. end
  3357. end
  3358.  
  3359. local function EquipState(CURRENTSTATE)
  3360. GUNSTANCE = true
  3361. if CURRENTSTATE == true then
  3362. RightShoulder.Parent = nil
  3363. LeftShoulder.Parent = nil
  3364. FakeRightShoulder.Parent = Torso
  3365. FakeLeftShoulder.Parent = Torso
  3366. for i = 0, 1, 0.05 do
  3367. RenderWait()
  3368. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
  3369. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
  3370. end
  3371. GUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
  3372. GunHandleMotor.Part0 = RightArm
  3373. GunHandleMotor.C0 = GUNHANDLEOFFSET
  3374. Spawn(function()
  3375. RenderWait()
  3376. GunUnholster:Play()
  3377. end)
  3378. for i = 0, 1, 0.05 do
  3379. RenderWait()
  3380. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45 + 90 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
  3381. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(35 + 10 * i), RAD(0), RAD(-35 - 10 * i)) * ANGLES(RAD(0), RAD(35 + 10 * i), RAD(0)), i)
  3382. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
  3383. end
  3384. for i = 0, 1, 0.05 do
  3385. RenderWait()
  3386. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.8) * ANGLES(RAD(110 - 20 * i), RAD(0), RAD(0 - 30 * i)), i)
  3387. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3388. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  3389. end
  3390. for i = 0, 1, 0.05 do
  3391. RenderWait()
  3392. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0.8) * ANGLES(RAD(80 + 10 * i), RAD(0), RAD(-30)), i)
  3393. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3394. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  3395. end
  3396. FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
  3397. FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
  3398. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
  3399. else
  3400. for i = 0, 1, 0.05 do
  3401. RenderWait()
  3402. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(45 - 90 * i), RAD(0), RAD(45)) * ANGLES(RAD(0), RAD(-35 - 10 * i), RAD(0)), i)
  3403. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(45 - 10 * i), RAD(0), RAD(-45 + 10 * i)) * ANGLES(RAD(0), RAD(45 - 10 * i), RAD(0)), i)
  3404. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(0), RAD(0)), i)
  3405. end
  3406. Spawn(function()
  3407. RenderWait()
  3408. GunHolster:Play()
  3409. end)
  3410. for i = 0, 1, 0.05 do
  3411. RenderWait()
  3412. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-45), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(50 + 10 * i), RAD(0), RAD(0)), i)
  3413. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
  3414. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, GUNHANDLEOFFSET, i)
  3415. end
  3416. GUNHANDLEOFFSET = Torso.CFrame:toObjectSpace(GunHandlePart.CFrame)
  3417. GunHandleMotor.Part0 = Torso
  3418. GunHandleMotor.C0 = GUNHANDLEOFFSET
  3419. for i = 0, 1, 0.05 do
  3420. RenderWait()
  3421. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(1 - 1 * i), RAD(0)), i)
  3422. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), i)
  3423. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(1, 0.4, 0.7) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0)), i)
  3424. end
  3425. FakeRightShoulder.Parent = nil
  3426. FakeLeftShoulder.Parent = nil
  3427. RightShoulder.Parent = Torso
  3428. LeftShoulder.Parent = Torso
  3429. GunHandleMotor.C0 = CF(1, 0.4, 0.7) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-45), RAD(0), RAD(0))
  3430. end
  3431. GUNSTANCE = false
  3432. end
  3433.  
  3434. local function BulletHole(POSITION, EFFECTCOLOR)
  3435. local BulletHolePart = IT("Part")
  3436. BulletHolePart.Anchored = true
  3437. BulletHolePart.FormFactor = "Custom"
  3438. BulletHolePart.TopSurface, BulletHolePart.BottomSurface, BulletHolePart.RightSurface, BulletHolePart.LeftSurface, BulletHolePart.FrontSurface, BulletHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  3439. BulletHolePart.Name = "Bullet Hole"
  3440. BulletHolePart.Material = "Plastic"
  3441. BulletHolePart.Reflectance = 0
  3442. BulletHolePart.Transparency = 1
  3443. BulletHolePart.CanCollide = false
  3444. BulletHolePart.Locked = true
  3445. BulletHolePart.BrickColor = BRICKC("Medium stone grey")
  3446. BulletHolePart.Size = VT(0.2, 0, 0.2)
  3447. BulletHolePart:BreakJoints()
  3448. BulletHolePart.CFrame = POSITION
  3449. BulletHolePart.Parent = EffectsFolder
  3450. local BulletHoleDecal = IT("Decal")
  3451. BulletHoleDecal.Color3 = C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  3452. BulletHoleDecal.Face = "Top"
  3453. BulletHoleDecal.Texture = "rbxassetid://359667865"
  3454. BulletHoleDecal.Transparency = 0
  3455. BulletHoleDecal.Parent = BulletHolePart
  3456. local BulletHoleSound = IT("Sound")
  3457. BulletHoleSound.Looped = false
  3458. BulletHoleSound.Volume = 1
  3459. BulletHoleSound.Pitch = MRANDOM(80, 120) / 100
  3460. BulletHoleSound.SoundId = "rbxassetid://"..BulletImpactSounds[13]
  3461. BulletHoleSound.Parent = BulletHolePart
  3462. local BulletHoleSound2 = IT("Sound")
  3463. BulletHoleSound2.Looped = false
  3464. BulletHoleSound2.Volume = 1
  3465. BulletHoleSound2.Pitch = MRANDOM(80, 120) / 100
  3466. BulletHoleSound2.SoundId = "rbxassetid://196864064"
  3467. BulletHoleSound2.Parent = BulletHolePart
  3468. local BulletImpactEffect = IT("ParticleEmitter")
  3469. BulletImpactEffect.Enabled = false
  3470. BulletImpactEffect.Texture = "rbxassetid://241685484"
  3471. BulletImpactEffect.Size = NUMSEQ(
  3472. {
  3473. NUMSEQKEYP(
  3474. 0, 0.05, 0.025
  3475. ),
  3476. NUMSEQKEYP(
  3477. 1, 0.05, 0.025
  3478. )
  3479. }
  3480. )
  3481. BulletImpactEffect.Transparency = NUMSEQ(
  3482. {
  3483. NUMSEQKEYP(
  3484. 0, 0, 0
  3485. ),
  3486. NUMSEQKEYP(
  3487. 1, 1, 0
  3488. )
  3489. }
  3490. )
  3491. BulletImpactEffect.Color = COLORSEQ(
  3492. {
  3493. COLORSEQKEYP(
  3494. 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  3495. ),
  3496. COLORSEQKEYP(
  3497. 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
  3498. )
  3499. }
  3500. )
  3501. BulletImpactEffect.VelocitySpread = 45
  3502. BulletImpactEffect.Lifetime = NUMRANGE(0.2, 0.2)
  3503. BulletImpactEffect.Speed = NUMRANGE(30, 30)
  3504. BulletImpactEffect.Acceleration = VT(0, -196.2, 0)
  3505. BulletImpactEffect.Drag = 0
  3506. BulletImpactEffect.VelocityInheritance = 0
  3507. BulletImpactEffect.Rate = 0
  3508. BulletImpactEffect.LightInfluence = 1
  3509. BulletImpactEffect.LightEmission = 0
  3510. BulletImpactEffect.ZOffset = 0
  3511. BulletImpactEffect.EmissionDirection = "Top"
  3512. BulletImpactEffect.Rotation = NUMRANGE(-360, 360)
  3513. BulletImpactEffect.RotSpeed = NUMRANGE(-360, 360)
  3514. BulletImpactEffect.LockedToPart = false
  3515. BulletImpactEffect.Parent = BulletHolePart
  3516. local BulletImpactEffect2 = IT("ParticleEmitter")
  3517. BulletImpactEffect2.Enabled = false
  3518. BulletImpactEffect2.Texture = "rbxassetid://709137722"
  3519. BulletImpactEffect2.Size = NUMSEQ(
  3520. {
  3521. NUMSEQKEYP(
  3522. 0, 0.5, 0
  3523. ),
  3524. NUMSEQKEYP(
  3525. 1, 0.5, 0
  3526. )
  3527. }
  3528. )
  3529. BulletImpactEffect2.Transparency = NUMSEQ(
  3530. {
  3531. NUMSEQKEYP(
  3532. 0, 0, 0
  3533. ),
  3534. NUMSEQKEYP(
  3535. 1, 1, 0
  3536. )
  3537. }
  3538. )
  3539. BulletImpactEffect2.Color = COLORSEQ(
  3540. {
  3541. COLORSEQKEYP(
  3542. 0, C3(EFFECTCOLOR.r, EFFECTCOLOR.g, EFFECTCOLOR.b)
  3543. ),
  3544. COLORSEQKEYP(
  3545. 1, C3(EFFECTCOLOR.r / 2, EFFECTCOLOR.g / 2, EFFECTCOLOR.b / 2)
  3546. )
  3547. }
  3548. )
  3549. BulletImpactEffect2.VelocitySpread = 10
  3550. BulletImpactEffect2.Lifetime = NUMRANGE(0.2, 0.2)
  3551. BulletImpactEffect2.Speed = NUMRANGE(2, 2)
  3552. BulletImpactEffect2.Acceleration = VT(0, 0, 0)
  3553. BulletImpactEffect2.Drag = 0
  3554. BulletImpactEffect2.VelocityInheritance = 0
  3555. BulletImpactEffect2.Rate = 0
  3556. BulletImpactEffect2.LightInfluence = 1
  3557. BulletImpactEffect2.LightEmission = 0
  3558. BulletImpactEffect2.ZOffset = 0.4
  3559. BulletImpactEffect2.EmissionDirection = "Top"
  3560. BulletImpactEffect2.Rotation = NUMRANGE(-360, 360)
  3561. BulletImpactEffect2.RotSpeed = NUMRANGE(-360, 360)
  3562. BulletImpactEffect2.LockedToPart = false
  3563. BulletImpactEffect2.Parent = BulletHolePart
  3564. Spawn(function()
  3565. RenderWait()
  3566. BulletImpactEffect:Emit(MRANDOM(5, 15))
  3567. BulletImpactEffect2:Emit(MRANDOM(1, 1))
  3568. BulletHoleSound:Play()
  3569. BulletHoleSound2:Play()
  3570. end)
  3571. end
  3572.  
  3573. local function FakeBullet(POSITION, VELOCITY)
  3574. local FakeBulletPart = IT("Part")
  3575. FakeBulletPart.Anchored = false
  3576. FakeBulletPart.FormFactor = "Custom"
  3577. FakeBulletPart.TopSurface, FakeBulletPart.BottomSurface, FakeBulletPart.RightSurface, FakeBulletPart.LeftSurface, FakeBulletPart.FrontSurface, FakeBulletPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  3578. FakeBulletPart.Name = "Bullet Shell"
  3579. FakeBulletPart.Material = "Plastic"
  3580. FakeBulletPart.Reflectance = 0
  3581. FakeBulletPart.Transparency = 0
  3582. FakeBulletPart.CanCollide = true
  3583. FakeBulletPart.Locked = true
  3584. FakeBulletPart.BrickColor = BRICKC("Bright yellow")
  3585. FakeBulletPart.Size = VT(0.32, 0.12, 0.12)
  3586. FakeBulletPart:BreakJoints()
  3587. FakeBulletPart.CFrame = POSITION
  3588. local FakeBulletMesh = IT("SpecialMesh")
  3589. FakeBulletMesh.MeshType = "Cylinder"
  3590. FakeBulletMesh.MeshId = ""
  3591. FakeBulletMesh.TextureId = ""
  3592. FakeBulletMesh.Offset = VT(0, 0, 0)
  3593. FakeBulletMesh.Scale = VT(1, 1, 1)
  3594. FakeBulletMesh.Parent = FakeBulletPart
  3595. FakeBulletPart.Parent = EffectsFolder
  3596. FakeBulletPart.Velocity = VELOCITY
  3597. game:GetService("Debris"):AddItem(FakeBulletPart, 3)
  3598. --[[
  3599. local BulletContact = IT("Sound")
  3600. BulletContact.Looped = false
  3601. BulletContact.Volume = 0.5
  3602. BulletContact.Pitch = 1
  3603. BulletContact.SoundId = "rbxassetid://"..BulletShellImpactSounds[5]
  3604. BulletContact.Parent = FakeBulletPart
  3605. local HITSOMETHING = false
  3606. FakeBulletPart.Touched:connect(function()
  3607. if HITSOMETHING == false then
  3608. HITSOMETHING = true
  3609. Spawn(function()
  3610. RenderWait()
  3611. BulletContact:Play()
  3612. end)
  3613. end
  3614. end)
  3615. --]]
  3616. end
  3617.  
  3618. local function FakeClip(POSITION, VELOCITY)
  3619. local FakeClipPart = IT("Part")
  3620. FakeClipPart.Anchored = false
  3621. FakeClipPart.FormFactor = "Custom"
  3622. FakeClipPart.TopSurface, FakeClipPart.BottomSurface, FakeClipPart.RightSurface, FakeClipPart.LeftSurface, FakeClipPart.FrontSurface, FakeClipPart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  3623. FakeClipPart.Name = "Clip"
  3624. FakeClipPart.Material = "Plastic"
  3625. FakeClipPart.Reflectance = 0
  3626. FakeClipPart.Transparency = 0
  3627. FakeClipPart.CanCollide = true
  3628. FakeClipPart.Locked = true
  3629. FakeClipPart.BrickColor = BRICKC("Black")
  3630. FakeClipPart.Size = VT(0.3, 0.3, 0.5)
  3631. FakeClipPart:BreakJoints()
  3632. FakeClipPart.CFrame = POSITION
  3633. FakeClipPart.Parent = EffectsFolder
  3634. FakeClipPart.Velocity = VELOCITY
  3635. game:GetService("Debris"):AddItem(FakeClipPart, 3)
  3636. end
  3637.  
  3638. local function ShootGun()
  3639. GUNSTANCE = true
  3640. local HITHUMANOID = nil
  3641. spawn(function()
  3642. RenderWait()
  3643. GunShot.Pitch = MRANDOM(90, 110) / 100
  3644. GunShot:Play()
  3645. end)
  3646. GunShotEffect:Emit(MRANDOM(4, 6))
  3647. GunLight.Range = 8
  3648. BULLETCOUNT = BULLETCOUNT - 1
  3649. for i = 1, 1 do
  3650. local GUNSPREAD = VT(MRANDOM(-0, 0) / 100, MRANDOM(-0, 0) / 100, MRANDOM(-0, 0) / 100) * ((GunHolePart.Position - Mouse.Hit.p).magnitude / 100)
  3651. local GUNRAY = Ray.new(GunHolePart.Position, (CF(GunHolePart.Position, Mouse.Hit.p + GUNSPREAD).lookVector).unit * 1000)
  3652. local GUNRAYHIT, GUNRAYPOSITION, GUNRAYANGLE = game:GetService("Workspace"):FindPartOnRay(GUNRAY, Character)
  3653. if GUNRAYHIT ~= nil then
  3654. if GUNRAYHIT.Parent:FindFirstChild("Humanoid") then
  3655. HITHUMANOID = GUNRAYHIT.Parent:FindFirstChild("Humanoid")
  3656. else
  3657. if GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid") then
  3658. HITHUMANOID = GUNRAYHIT.Parent.Parent:FindFirstChild("Humanoid")
  3659. end
  3660. end
  3661. if HITHUMANOID ~= nil and HITHUMANOID.Parent ~= Character then
  3662. if GUNRAYHIT.Name == "Head" or GUNRAYHIT.ClassName == "Accessory" then
  3663. HITHUMANOID.Health = 0
  3664. else
  3665. HITHUMANOID.Health = HITHUMANOID.Health - (HITHUMANOID.MaxHealth * (math.random(7,10)/10))
  3666. end
  3667. else
  3668. BulletHole(CF(GUNRAYPOSITION, GUNRAYPOSITION - GUNRAYANGLE) * ANGLES(RAD(90), RAD(0), RAD(0)) * ANGLES(RAD(0), RAD(MRANDOM(-360, 360)), RAD(0)), GUNRAYHIT.BrickColor)
  3669. end
  3670. end
  3671. end
  3672. SMOKETIME = 2
  3673. for i = 0, 1, 0.1 do
  3674. RenderWait()
  3675. GunLight.Range = 8 - (8 * i)
  3676. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 1) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  3677. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.3) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3678. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  3679. end
  3680. GunLight.Range = 0
  3681. for i = 0, 1, 0.1 do
  3682. RenderWait()
  3683. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  3684. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(20 - 20 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3685. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  3686. end
  3687. local FAKEGUNHANDLEOFFSET = LeftArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
  3688. GunHandleMotor.Part0 = LeftArm
  3689. GunHandleMotor.C0 = FAKEGUNHANDLEOFFSET
  3690. for i = 0, 1, 0.1 do
  3691. RenderWait()
  3692. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  3693. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3694. end
  3695. for i = 0, 1, 0.1 do
  3696. RenderWait()
  3697. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(110 + 10 * i), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(70 + 10 * i), RAD(0)), i)
  3698. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3699. end
  3700. Spawn(function()
  3701. RenderWait()
  3702. GunChamberBack:Play()
  3703. end)
  3704. FakeBullet(GunHandlePart.CFrame * CF(0, 0.7, 0.1) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20)), RAD(MRANDOM(-20, 20))), (GunHandlePart.CFrame * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(30), RAD(0), RAD(0))).lookVector * 20)
  3705. for i = 0, 1, 0.1 do
  3706. RenderWait()
  3707. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 1.1 + 0.1 * i) * ANGLES(RAD(120), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3708. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.4) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3709. end
  3710. Spawn(function()
  3711. RenderWait()
  3712. GunChamberForward:Play()
  3713. end)
  3714. for i = 0, 1, 0.1 do
  3715. RenderWait()
  3716. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.9 - 0.1 * i) * ANGLES(RAD(120), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(70), RAD(0)), i)
  3717. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3718. end
  3719. for i = 0, 1, 0.1 do
  3720. RenderWait()
  3721. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-20 - 10 * i)), i)
  3722. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3723. end
  3724. FAKEGUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
  3725. GunHandleMotor.Part0 = RightArm
  3726. GunHandleMotor.C0 = FAKEGUNHANDLEOFFSET
  3727. for i = 0, 1, 0.1 do
  3728. RenderWait()
  3729. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  3730. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3731. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  3732. end
  3733. FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
  3734. FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
  3735. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
  3736. GUNSTANCE = false
  3737. end
  3738.  
  3739. local function ReloadGun()
  3740. GUNSTANCE = true
  3741. if BULLETCOUNT <= 0 then
  3742. CHAMBEREMPTY = true
  3743. end
  3744. for i = 0, 1, 0.05 do
  3745. RenderWait()
  3746. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.1 - 0.1 * i) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  3747. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(-0.2, 0.5, -1) * ANGLES(RAD(90), RAD(0), RAD(45)) * ANGLES(RAD(15), RAD(0 - 10 * i), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3748. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  3749. end
  3750. Spawn(function()
  3751. RenderWait()
  3752. GunReload.Pitch = 0.6
  3753. GunReload:Play()
  3754. end)
  3755. FakeClip(GunHandlePart.CFrame * CF(0.05, 0.4, -0.7) * ANGLES(RAD(0), RAD(0), RAD(0)), (GunHandlePart.CFrame * ANGLES(RAD(-90), RAD(0), RAD(0))).lookVector * 10)
  3756. for i = 0, 1, 0.05 do
  3757. RenderWait()
  3758. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  3759. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(10 - 10 * i), RAD(0), RAD(0)), i)
  3760. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  3761. end
  3762. Spawn(function()
  3763. RenderWait()
  3764. GunReload.Pitch = 0.9
  3765. GunReload:Play()
  3766. end)
  3767. for i = 0, 1, 0.05 do
  3768. RenderWait()
  3769. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.1 - 0.1 * i) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  3770. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(0 + 10 * i), RAD(0), RAD(0)) * CF(-0.2, 0.5, -1) * ANGLES(RAD(90), RAD(0), RAD(45)) * ANGLES(RAD(15), RAD(0 - 10 * i), RAD(0)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3771. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  3772. end
  3773. for i = 0, 1, 0.05 do
  3774. RenderWait()
  3775. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.7 + 0.1 * i) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  3776. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 + 10 * i), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3777. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  3778. end
  3779. if BULLETCOUNT > 0 then
  3780. GunReload:Stop()
  3781. end
  3782. if CHAMBEREMPTY == true then
  3783. CHAMBEREMPTY = false
  3784. local FAKEGUNHANDLEOFFSET = LeftArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
  3785. GunHandleMotor.Part0 = LeftArm
  3786. GunHandleMotor.C0 = FAKEGUNHANDLEOFFSET
  3787. for i = 0, 1, 0.1 do
  3788. RenderWait()
  3789. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  3790. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3791. end
  3792. for i = 0, 1, 0.1 do
  3793. RenderWait()
  3794. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(110 + 10 * i), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(70 + 10 * i), RAD(0)), i)
  3795. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3796. end
  3797. Spawn(function()
  3798. RenderWait()
  3799. GunChamberBack:Play()
  3800. end)
  3801. for i = 0, 1, 0.1 do
  3802. RenderWait()
  3803. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 1.1 + 0.1 * i) * ANGLES(RAD(120), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3804. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.4) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3805. end
  3806. Spawn(function()
  3807. RenderWait()
  3808. GunChamberForward:Play()
  3809. end)
  3810. for i = 0, 1, 0.1 do
  3811. RenderWait()
  3812. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.9 - 0.1 * i) * ANGLES(RAD(120), RAD(0), RAD(-5)) * ANGLES(RAD(0), RAD(80), RAD(0)), i)
  3813. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3814. end
  3815. for i = 0, 1, 0.1 do
  3816. RenderWait()
  3817. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-20 - 10 * i)), i)
  3818. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(-20), RAD(0), RAD(0)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3819. end
  3820. FAKEGUNHANDLEOFFSET = RightArm.CFrame:toObjectSpace(GunHandlePart.CFrame)
  3821. GunHandleMotor.Part0 = RightArm
  3822. GunHandleMotor.C0 = FAKEGUNHANDLEOFFSET
  3823. for i = 0, 1, 0.1 do
  3824. RenderWait()
  3825. FakeRightShoulder.C0 = Clerp(FakeRightShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30)), i)
  3826. FakeLeftShoulder.C0 = Clerp(FakeLeftShoulder.C0, ANGLES(RAD(10 - 10 * i), RAD(0), RAD(-10 + 10 * i)) * CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0)), i)
  3827. GunHandleMotor.C0 = Clerp(GunHandleMotor.C0, CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0)), i)
  3828. end
  3829. end
  3830. FakeRightShoulder.C0 = CF(1.5, 0.5, 0.8) * ANGLES(RAD(90), RAD(0), RAD(-30))
  3831. FakeLeftShoulder.C0 = CF(-0.5, 0.5, -1.5) * ANGLES(RAD(90), RAD(0), RAD(60)) * ANGLES(RAD(0), RAD(90), RAD(0))
  3832. GunHandleMotor.C0 = CF(0, -1, 0) * ANGLES(RAD(-90), RAD(-30), RAD(0))
  3833. BULLETCOUNT = MAXBULLETS
  3834. GUNSTANCE = false
  3835. end
  3836.  
  3837.  
  3838.  
  3839.  
  3840.  
  3841. --//=================================\\
  3842. --|| SET THINGS UP
  3843. --\\=================================//
  3844.  
  3845. Mouse.Button1Down:connect(function()
  3846. if GUNSTANCE == false and EQUIPPED == true then
  3847. if BULLETCOUNT > 0 then
  3848. ShootGun()
  3849. elseif BULLETCOUNT <= 0 then
  3850. ReloadGun()
  3851. end
  3852. end
  3853. end)
  3854. Mouse.KeyDown:connect(function(KEY)
  3855. if KEY == "y" and GUNSTANCE == false then
  3856. if EQUIPPED == false then
  3857. EQUIPPED = true
  3858. else
  3859. EQUIPPED = false
  3860. end
  3861. EquipState(EQUIPPED)
  3862. end
  3863. if KEY == "r" and GUNSTANCE == false and EQUIPPED == true then
  3864. ReloadGun()
  3865. end
  3866. end)
  3867.  
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873. --//=================================\\
  3874. --|| WRAP THE WHOLE SCRIPT UP
  3875. --\\=================================//
  3876.  
  3877. while true do
  3878. RenderWait()
  3879. SMOKETIME = SMOKETIME - (1 / 30) / 2
  3880. if SMOKETIME <= 0 then
  3881. if GunSmoke.Enabled == true then
  3882. GunSmoke.Enabled = false
  3883. end
  3884. else
  3885. if GunSmoke.Enabled == false then
  3886. GunSmoke.Enabled = true
  3887. end
  3888. end
  3889. end
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895. --//====================================================\\--
  3896. --|| END OF SCRIPT
  3897. --\\====================================================//--
  3898. end))
  3899. for i,v in pairs(mas:GetChildren()) do
  3900. v.Parent = workspace
  3901. pcall(function() v:MakeJoints() end)
  3902. end
  3903. mas:Destroy()
  3904. for i,v in pairs(cors) do
  3905. spawn(function()
  3906. pcall(v)
  3907. end)
  3908. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement