KrYn0MoRe

Raygun Mark I

Sep 11th, 2020 (edited)
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 71.69 KB | None | 0 0
  1. local plr = owner
  2. local char = plr.Character
  3. local hum = char:FindFirstChildOfClass("Humanoid")
  4. local torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")
  5. local rootpart = char:FindFirstChild("HumanoidRootPart")
  6.  
  7. local debris = game:GetService("Debris")
  8. local tween = game:GetService("TweenService")
  9.  
  10. local gun = Instance.new("Tool")
  11. local han = Instance.new("Part")
  12. local SpecialMesh2 = Instance.new("SpecialMesh")
  13. local PointLight3 = Instance.new("PointLight")
  14. gun.Name = "Raygun"
  15. gun.Parent = plr['Backpack']
  16. gun.ToolTip = 'It shoot rays!'
  17. gun.CanBeDropped = false
  18. gun.Grip = CFrame.new(-0.765321732, 0.0157508533, -0.438668579, -4.37113847e-08, -4.37113883e-08, -1, -0.99999994, 1.91068547e-15, 4.37113883e-08, 0, 0.99999994, -4.37113847e-08)
  19. gun.GripForward = Vector3.new(1, -4.37113883e-08, 4.37113847e-08)
  20. gun.GripPos = Vector3.new(-0.765321732, 0.0157508533, -0.438668579)
  21. gun.GripRight = Vector3.new(-4.37113847e-08, -0.99999994, 0)
  22. gun.GripUp = Vector3.new(-4.37113883e-08, 1.91068547e-15, 0.99999994)
  23. gun.CanBeDropped = false
  24. han.Name = "Handle"
  25. han.Parent = gun
  26. han.CFrame = CFrame.new(-6.08354521, 1.794029, -15.814826, -1, -8.74227766e-08, -3.82137093e-15, 0, -4.37113883e-08, 1, -8.74227766e-08, 1, 4.37113883e-08)
  27. han.Orientation = Vector3.new(-90, 180, 0)
  28. han.Position = Vector3.new(-6.08354521, 1.794029, -15.814826)
  29. han.Rotation = Vector3.new(-90, 0, 180)
  30. han.Color = Color3.new(0.388235, 0.372549, 0.384314)
  31. han.Size = Vector3.new(2.68400002, 0.55400002, 1.34800005)
  32. han.BottomSurface = Enum.SurfaceType.Smooth
  33. han.BrickColor = BrickColor.new("Dark stone grey")
  34. han.Reflectance = 0.40000000596046
  35. han.TopSurface = Enum.SurfaceType.Smooth
  36. han.brickColor = BrickColor.new("Dark stone grey")
  37. SpecialMesh2.Parent = han
  38. SpecialMesh2.MeshId = "rbxassetid://5679522325"
  39. SpecialMesh2.Scale = Vector3.new(0.0599999987, 0.0599999987, 0.0599999987)
  40. SpecialMesh2.TextureId = "rbxassetid://430279131"
  41. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  42. PointLight3.Parent = han
  43. PointLight3.Color = Color3.new(0.0588235, 1, 0.796079)
  44. PointLight3.Range = 1.5
  45. PointLight3.Brightness = 5
  46.  
  47. function fx_spot(pos)
  48.     local att_part = Instance.new("Part")
  49.     att_part.Transparency = 1
  50.     att_part.CanCollide = false
  51.     att_part.Anchored = true
  52.     att_part.Size = Vector3.new()
  53.     att_part.Position = pos
  54.     att_part.Parent = workspace
  55.     local att = Instance.new("Attachment")
  56.     att.Parent = att_part
  57.     local ParticleEmitter0 = Instance.new("ParticleEmitter")
  58.     local ParticleEmitter1 = Instance.new("ParticleEmitter")
  59.     ParticleEmitter0.Parent = att
  60.     ParticleEmitter0.Speed = NumberRange.new(0, 0)
  61.     ParticleEmitter0.Rotation = NumberRange.new(9999999, 9999999)
  62.     ParticleEmitter0.Color = ColorSequence.new(Color3.new(0.133333, 1, 0.0392157),Color3.new(0.133333, 1, 0.0392157))
  63.     ParticleEmitter0.Enabled = false
  64.     ParticleEmitter0.LightEmission = 1
  65.     ParticleEmitter0.Transparency = NumberSequence.new(0,1)
  66.     ParticleEmitter0.Size = NumberSequence.new(0,7,0)
  67.     ParticleEmitter0.Lifetime = NumberRange.new(1, 1)
  68.     ParticleEmitter0.LockedToPart = true
  69.     ParticleEmitter0.Rate = 100
  70.     ParticleEmitter0.RotSpeed = NumberRange.new(9999999, 9999999)
  71.     ParticleEmitter1.Parent = att
  72.     ParticleEmitter1.Speed = NumberRange.new(0, 0)
  73.     ParticleEmitter1.Rotation = NumberRange.new(9999999, 9999999)
  74.     ParticleEmitter1.Color = ColorSequence.new(Color3.new(0.196078, 1, 0.054902),Color3.new(0, 0, 0))
  75.     ParticleEmitter1.Enabled = false
  76.     ParticleEmitter1.LightEmission = 1
  77.     ParticleEmitter1.Texture = "rbxassetid://348501463"
  78.     ParticleEmitter1.Transparency = NumberSequence.new(0.5625,0,1)
  79.     ParticleEmitter1.Size = NumberSequence.new(5.3,1,4.2)
  80.     ParticleEmitter1.Lifetime = NumberRange.new(1, 1)
  81.     ParticleEmitter1.LockedToPart = true
  82.     ParticleEmitter1.Rate = 100
  83.     ParticleEmitter1.RotSpeed = NumberRange.new(9999999, 9999999)
  84.     spawn(function()
  85.         ParticleEmitter0.Enabled = true
  86.         ParticleEmitter1.Enabled = true
  87.         wait(0.15)
  88.         ParticleEmitter0.Enabled = false
  89.         ParticleEmitter1.Enabled = false
  90.     end)
  91.     game:GetService("Debris"):AddItem(att,2)
  92. end
  93.  
  94. local effect_part = Instance.new("Part")
  95. local smoke = Instance.new("ParticleEmitter")
  96. local flash = Instance.new("ParticleEmitter")
  97. local light = Instance.new("PointLight")
  98. effect_part.Name = "effect"
  99. effect_part.Parent = gun
  100. effect_part.CFrame = CFrame.new(-14.3099976, 2.64201403, -6.57999992, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  101. effect_part.Position = Vector3.new(-14.3099976, 2.64201403, -6.57999992)
  102. effect_part.Transparency = 1
  103. effect_part.Size = Vector3.new(0.100000001, 0.100000001, 0.100000001)
  104. effect_part.BottomSurface = Enum.SurfaceType.Smooth
  105. effect_part.CanCollide = false
  106. effect_part.TopSurface = Enum.SurfaceType.Smooth
  107. smoke.Name = "smoke"
  108. smoke.Parent = effect_part
  109. smoke.Speed = NumberRange.new(5, 7)
  110. smoke.Rotation = NumberRange.new(0, 360)
  111. smoke.Color = ColorSequence.new(Color3.new(0.27451, 0.27451, 0.27451),Color3.new(0.27451, 0.27451, 0.27451))
  112. smoke.Enabled = false
  113. smoke.LightEmission = 0.10000000149012
  114. smoke.Texture = "http://www.roblox.com/asset/?id=244514423"
  115. smoke.Transparency = NumberSequence.new(0.60000002384186,1)
  116. smoke.Size = NumberSequence.new(0.99999964237213,3)
  117. smoke.Lifetime = NumberRange.new(1.25, 1.5)
  118. smoke.Rate = 100
  119. smoke.RotSpeed = NumberRange.new(10, 10)
  120. smoke.SpreadAngle = Vector2.new(15, 15)
  121. smoke.VelocitySpread = 15
  122. flash.Name = "flash"
  123. flash.Parent = effect_part
  124. flash.Speed = NumberRange.new(0, 0)
  125. flash.Rotation = NumberRange.new(0, 90)
  126. flash.Color = ColorSequence.new(Color3.new(1, 1, 0.498039),Color3.new(1, 1, 0.498039))
  127. flash.Enabled = false
  128. flash.LightEmission = 1
  129. flash.Texture = "http://www.roblox.com/asset/?id=3419963"
  130. flash.Transparency = NumberSequence.new(0.75,1)
  131. flash.Size = NumberSequence.new(0.20000000298023,0.20000000298023)
  132. flash.Lifetime = NumberRange.new(0.050000000745058, 0.075000002980232)
  133. flash.Rate = 1000
  134. light.Name = "light"
  135. light.Parent = effect_part
  136. light.Color = Color3.new(1, 1, 0.498039)
  137. light.Enabled = false
  138. light.Range = 6
  139. light.Brightness = 10
  140. light.Shadows = true
  141.  
  142. local weld = Instance.new("Weld")
  143. weld.Part0 = han
  144. weld.Part1 = effect_part
  145. weld.C1 = weld.C1 * CFrame.new(-(han.Size.X/2-0.05),0,-0.25)
  146. weld.Parent = effect_part
  147.  
  148. local cols = {BrickColor.new("Neon orange"),BrickColor.new("Really red"),BrickColor.new("Bright red"),BrickColor.new("Br. yellowish orange"),BrickColor.new("Bright yellow")}
  149. local taunts = {298689061,2743459732,2852509470,1018518369}
  150. local using = false
  151. local op = false
  152. local bulletfire = 1
  153. local shootwait = 0.15*bulletfire
  154. local max_ammo = 20
  155. local ammo = max_ammo
  156. local hitpos = nil
  157. local shooting = false
  158. local equipped = false
  159.  
  160. local shoot_s = Instance.new("Sound")
  161. shoot_s.Name = 'shoot'
  162. shoot_s.SoundId = 'rbxassetid://131179973'
  163. shoot_s.Volume = 4
  164. shoot_s.Parent = han
  165.  
  166. local reload_s = Instance.new("Sound")
  167. reload_s.SoundId = 'rbxassetid://336591667'
  168. reload_s.Volume = 0.8
  169. reload_s.Parent = han
  170.  
  171. local wbreak = Instance.new("Sound")
  172. wbreak.Parent = han
  173. wbreak.SoundId = "rbxassetid://627558611"
  174. wbreak.TimePosition = .1
  175. wbreak.Volume = 0.7
  176.  
  177. function CheckIfAlive()
  178.     local alive = false
  179.     if plr and char and char.Parent and torso and torso.Parent and hum and hum.Parent and hum.Health > 0 then
  180.         alive = true
  181.     end
  182.     return alive
  183. end
  184. function limb_collide(obj,mode)
  185.     if (obj:IsA("UnionOperation") or obj:IsA("BasePart")) and not obj:FindFirstChild('limb') then else return end
  186.     local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  187.     if not exists then
  188.         game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  189.     end
  190.     game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  191.     --
  192.     local t = {}
  193.     --
  194.     local cb = Instance.new("Part")
  195.     cb.Name = 'limb'
  196.     cb.Transparency = 1
  197.     cb.CanCollide = true
  198.     cb.Anchored = false
  199.     cb.CFrame = obj.CFrame
  200.     cb.Size = obj.Size
  201.     cb.Massless = true
  202.     cb.Locked = true
  203.     game:GetService("PhysicsService"):SetPartCollisionGroup(cb,'Limb Collide')
  204.     game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
  205.     local weld = Instance.new("Weld")
  206.     weld.Part0 = cb
  207.     weld.Part1 = obj
  208.     weld.Parent = cb
  209.     obj.Massless = true
  210.     obj.Anchored = false
  211.     if mode or obj:FindFirstChild("Dismembered") then
  212.         cb.Parent = obj -- .Parent
  213.     else
  214.         cb.Parent = script
  215.         table.insert(t,1,cb)
  216.     end
  217.     --
  218.     if not string.match(obj.Name:lower(),'torso') and not string.match(obj.Name:lower(),'rootpart') and not string.match(obj.Name:lower(),'head') then
  219.         local lv = Vector3.new() -- Vector3.new(cb.Size.X,0,cb.Size.Z)
  220.         local cb2 = Instance.new("Part")
  221.         cb2.Name = 'limb'
  222.         cb2.Transparency = 1
  223.         cb2.CanCollide = true
  224.         cb2.Anchored = false
  225.         cb2.CFrame = obj.CFrame
  226.         cb2.Size = lv
  227.         cb2.Massless = true
  228.         cb2.Locked = true
  229.         local weld2 = Instance.new("Weld")
  230.         weld2.Part0 = cb
  231.         weld2.Part1 = cb2
  232.         weld2.C1 = CFrame.new(0,(cb.Size.Y/2),0)
  233.         weld2.Parent = cb2
  234.         if mode or obj:FindFirstChild("Dismembered") then
  235.             cb2.Parent = obj -- .Parent
  236.         else
  237.             cb2.Parent = script
  238.             table.insert(t,1,cb2)
  239.         end
  240.     end
  241.     --
  242.     return t
  243. end
  244. function Ragdoll(targchar,headless,insta,kill)
  245.     local pc = targchar
  246.     local targhum = pc:FindFirstChild("Humanoid")
  247.     local js,js2 = {},{}
  248.     for _,obj in pairs(pc:GetDescendants()) do
  249.         if obj:IsA("BasePart") or obj:IsA("UnionOperation") then
  250.             obj.Massless = true
  251.             obj.Locked = true
  252.         end
  253.     end
  254.     if kill == true then
  255.         pc.Archivable = true
  256.         local old_pc = pc
  257.         pc = pc:Clone()
  258.         for i,v in pairs(pc:GetDescendants()) do
  259.             limb_collide(v,true)
  260.             if v:IsA("ParticleEmitter") then
  261.                 v.Enabled = false
  262.             end
  263.             if v:IsA("SelectionBox") or v:IsA("BodyVelocity") or v:IsA("BodyPosition") or v:IsA("BodyAngularVelocity") or v:IsA("BodyForce") or v:IsA("BodyGyro") or v:IsA("BodyThrust") or v:IsA("BodyMover") then
  264.                 if v:IsA("BodyVelocity") then
  265.                     game:GetService("Debris"):AddItem(v,0.15)
  266.                 else
  267.                     v:Destroy()
  268.                 end
  269.             end
  270.             if (v:IsA("Script") and v.Name == 'Health') or (v:IsA("LocalScript") and v.Name == 'Animate') then
  271.                 v:Destroy()
  272.             end
  273.             if v:IsA("Humanoid") then
  274.                 v.BreakJointsOnDeath = false
  275.                 v.Health = 0
  276.                 v.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
  277.                 v.PlatformStand = true
  278.             end
  279.         end
  280.         for i,v in pairs(old_pc:GetDescendants()) do
  281.             if v:IsA("BasePart") or v:IsA("UnionOperation") or v:IsA("ForceField") or v:IsA("Accessory") or v:IsA("Decal") or v:IsA("Texture") or v:IsA("SurfaceGui") then
  282.                 v:destroy()
  283.             end
  284.             if v:IsA("Humanoid") then
  285.                 v.BreakJointsOnDeath = true
  286.                 v.Health = 0
  287.                 v.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
  288.                 v.PlatformStand = true
  289.             end
  290.         end
  291.         pc.Parent = workspace
  292.         game:GetService("Debris"):AddItem(pc,30)
  293.     end
  294.     --if kill and targhum:FindFirstChild("Ragdolled") then return; end;
  295.     if pc ~= nil then
  296.         local hum = pc:FindFirstChild'Humanoid'
  297.         local LArm = pc:FindFirstChild'Left Arm'
  298.         local RArm = pc:FindFirstChild'Right Arm'
  299.         local LLeg = pc:FindFirstChild'Left Leg'
  300.         local RLeg = pc:FindFirstChild'Right Leg'
  301.         local torso = pc:FindFirstChild'Torso'
  302.         local head = pc:FindFirstChild'Head'
  303.        
  304.        
  305.         local LUA = pc:FindFirstChild'LeftUpperArm'
  306.         local LLA = pc:FindFirstChild'LeftLowerArm'
  307.         local LH = pc:FindFirstChild'LeftHand'
  308.        
  309.         local RUA = pc:FindFirstChild'RightUpperArm'
  310.         local RLA = pc:FindFirstChild'RightLowerArm'
  311.         local RH = pc:FindFirstChild'RightHand'
  312.        
  313.         local LUL = pc:FindFirstChild'LeftUpperLeg'
  314.         local LLL = pc:FindFirstChild'LeftLowerLeg'
  315.         local LF = pc:FindFirstChild'LeftFoot'
  316.        
  317.         local RUL = pc:FindFirstChild'RightUpperLeg'
  318.         local RLL = pc:FindFirstChild'RightLowerLeg'
  319.         local RF = pc:FindFirstChild'RightFoot'
  320.        
  321.         local UT = pc:FindFirstChild'UpperTorso'
  322.         local LT = pc:FindFirstChild'LowerTorso'
  323.        
  324.         if hum and LArm and RArm and LLeg and RLeg and head then
  325.             hum.BreakJointsOnDeath = false
  326.             if insta then
  327.                 if hum.RigType==Enum.HumanoidRigType.R6 then
  328.                     for _,v in pairs(torso:GetDescendants()) do
  329.                         if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA('Weld') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then
  330.                             if not kill then
  331.                                 table.insert(js2,1,{obj = v,par = v.Parent})
  332.                                 v.Parent = nil
  333.                             elseif kill then
  334.                                 v:Destroy()
  335.                             end
  336.                         end
  337.                     end
  338.                    local vis = false
  339.                    local vis2 = false
  340.                     if LArm and not LArm:FindFirstChild('Dismembered') then
  341.                        local at1 = Instance.new("Attachment")
  342.                        at1.Parent = torso
  343.                        at1.Visible = vis
  344.                        at1.Orientation = torso.Orientation + Vector3.new(0,180,0)
  345.                        at1.Position = Vector3.new(-1,1,0)
  346.                                        
  347.                        local at1p2 = Instance.new("Attachment")
  348.                        at1p2.Parent = LArm
  349.                        at1p2.Visible = vis
  350.                        at1p2.Orientation = LArm.Orientation + Vector3.new(0,180,0)
  351.                        at1p2.Position = Vector3.new(.5,1,0)
  352.                            
  353.                        local bis = Instance.new("BallSocketConstraint")
  354.                        bis.Parent = LArm
  355.                        bis.Attachment0 = at1
  356.                        bis.Attachment1 = at1p2
  357.                        bis.LimitsEnabled = true
  358.                        bis.UpperAngle = 15
  359.                        bis.Visible = vis2
  360.                        bis.TwistLimitsEnabled = true
  361.                        bis.UpperAngle = -45
  362.                        bis.TwistLowerAngle = -45
  363.                         table.insert(js,1,bis)
  364.                     end
  365.                     if RArm and not RArm:FindFirstChild('Dismembered') then    
  366.                         local at2 = Instance.new("Attachment")
  367.                         at2.Parent = torso
  368.                         at2.Visible = vis
  369.                         at2.Orientation = torso.Orientation + Vector3.new(0,0,0)
  370.                         at2.Position = Vector3.new(1,1,0)
  371.                                
  372.                         local at2p2 = Instance.new("Attachment")
  373.                         at2p2.Parent = RArm
  374.                         at2p2.Visible = vis
  375.                         at2p2.Orientation = RArm.Orientation + Vector3.new(0,0,0)
  376.                         at2p2.Position = Vector3.new(-.5,1,0)
  377.                        
  378.                         local bis2 = Instance.new("BallSocketConstraint")
  379.                         bis2.Parent = RArm
  380.                         bis2.Attachment0 = at2
  381.                         bis2.Attachment1 = at2p2
  382.                         bis2.LimitsEnabled = true
  383.                         bis2.UpperAngle = 15
  384.                         bis2.Visible = vis2
  385.                         bis2.TwistLimitsEnabled = true
  386.                         bis2.UpperAngle = -45
  387.                         bis2.TwistLowerAngle = -45
  388.                         table.insert(js,1,bis2)
  389.                     end
  390.                      if RLeg and not RLeg:FindFirstChild('Dismembered') then
  391.                         local at3 = Instance.new("Attachment")
  392.                         at3.Parent = torso
  393.                         at3.Visible = vis
  394.                         at3.Orientation = torso.Orientation + Vector3.new(90,0,-90)
  395.                         at3.Position = Vector3.new(.5,-1,0)
  396.                                
  397.                         local at3p2 = Instance.new("Attachment")
  398.                         at3p2.Parent = RLeg
  399.                         at3p2.Visible = vis
  400.                         at3p2.Orientation = RLeg.Orientation + Vector3.new(90,0,-90)
  401.                         at3p2.Position = Vector3.new(0,1,0)
  402.                        
  403.                         local bis3 = Instance.new("BallSocketConstraint")
  404.                         bis3.Parent = RLeg
  405.                         bis3.Attachment0 = at3
  406.                         bis3.Attachment1 = at3p2
  407.                         bis3.LimitsEnabled = true
  408.                         bis3.UpperAngle = 180-15
  409.                         bis3.Visible = vis2
  410.                         table.insert(js,1,bis3)
  411.                     end
  412.                          
  413.                     if LLeg and not LLeg:FindFirstChild('Dismembered') then  
  414.                         local at4 = Instance.new("Attachment")
  415.                         at4.Parent = torso
  416.                         at4.Visible = vis
  417.                         at4.Orientation = torso.Orientation + Vector3.new(90,0,-90)
  418.                         at4.Position = Vector3.new(-.5,-1,0)
  419.                                
  420.                         local at4p2 = Instance.new("Attachment")
  421.                         at4p2.Parent = LLeg
  422.                         at4p2.Visible = vis
  423.                         at4p2.Orientation = LLeg.Orientation + Vector3.new(90,0,-90)
  424.                         at4p2.Position = Vector3.new(0,1,0)
  425.                    
  426.                         local bis4 = Instance.new("BallSocketConstraint")
  427.                         bis4.Parent = LLeg
  428.                         bis4.Attachment0 = at4
  429.                         bis4.Attachment1 = at4p2
  430.                         bis4.LimitsEnabled = true
  431.                         bis4.UpperAngle = 180-15
  432.                         bis4.Visible = vis2
  433.                         table.insert(js,1,bis4)
  434.                     end
  435.                    
  436.                     if head and not headless and not head:FindFirstChild('Dismembered') then  
  437.                             local at5 = Instance.new("Attachment")
  438.                             at5.Parent = torso
  439.                             at5.Visible = vis
  440.                             at5.Orientation = torso.Orientation + Vector3.new(180,90,0)
  441.                             at5.Position = Vector3.new(0,1,0)
  442.                          
  443.                             local at5p2 = Instance.new("Attachment")
  444.                             at5p2.Parent = head
  445.                             at5p2.Visible = vis
  446.                             at5p2.Orientation = head.Orientation + Vector3.new(180,90,0)
  447.                             at5p2.Position = Vector3.new(0,-.5,0)
  448.                    
  449.                             local bis5 = Instance.new("BallSocketConstraint")
  450.                             bis5.Parent = head
  451.                             bis5.Attachment0 = at5p2
  452.                             bis5.Attachment1 = at5
  453.                             bis5.LimitsEnabled = true
  454.                             bis5.UpperAngle = 75
  455.                             bis5.Visible = vis2
  456.                             bis5.TwistLimitsEnabled = true
  457.                             bis5.UpperAngle = -45
  458.                             bis5.TwistLowerAngle = -45
  459.                             table.insert(js,1,bis5)
  460.                         else
  461.                             --head:BreakJoints()
  462.                         end
  463.                     end
  464.             else
  465.                 hum.Died:Connect(function()
  466.                 if hum.RigType==Enum.HumanoidRigType.R6 then
  467.                     for _,v in pairs(torso:GetDescendants()) do
  468.                         if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA('Weld') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then
  469.                             if not kill then
  470.                                 table.insert(js2,1,{obj = v,par = v.Parent})
  471.                                 v.Parent = nil
  472.                             elseif kill then
  473.                                 v:Destroy()
  474.                             end
  475.                         end
  476.                     end
  477.                    local vis = false
  478.                    local vis2 = false
  479.                     if LArm and not LArm:FindFirstChild('Dismembered') then
  480.                        local at1 = Instance.new("Attachment")
  481.                        at1.Parent = torso
  482.                        at1.Visible = vis
  483.                        at1.Orientation = torso.Orientation + Vector3.new(0,180,0)
  484.                        at1.Position = Vector3.new(-1,1,0)
  485.                                        
  486.                        local at1p2 = Instance.new("Attachment")
  487.                        at1p2.Parent = LArm
  488.                        at1p2.Visible = vis
  489.                        at1p2.Orientation = LArm.Orientation + Vector3.new(0,180,0)
  490.                        at1p2.Position = Vector3.new(.5,1,0)
  491.                            
  492.                        local bis = Instance.new("BallSocketConstraint")
  493.                        bis.Parent = LArm
  494.                        bis.Attachment0 = at1
  495.                        bis.Attachment1 = at1p2
  496.                        bis.LimitsEnabled = true
  497.                        bis.UpperAngle = 15
  498.                        bis.Visible = vis2
  499.                        bis.TwistLimitsEnabled = true
  500.                        bis.UpperAngle = -45
  501.                        bis.TwistLowerAngle = -45
  502.                         table.insert(js,1,bis)
  503.                     end
  504.                     if RArm and not RArm:FindFirstChild('Dismembered') then    
  505.                         local at2 = Instance.new("Attachment")
  506.                         at2.Parent = torso
  507.                         at2.Visible = vis
  508.                         at2.Orientation = torso.Orientation + Vector3.new(0,0,0)
  509.                         at2.Position = Vector3.new(1,1,0)
  510.                                
  511.                         local at2p2 = Instance.new("Attachment")
  512.                         at2p2.Parent = RArm
  513.                         at2p2.Visible = vis
  514.                         at2p2.Orientation = RArm.Orientation + Vector3.new(0,0,0)
  515.                         at2p2.Position = Vector3.new(-.5,1,0)
  516.                        
  517.                         local bis2 = Instance.new("BallSocketConstraint")
  518.                         bis2.Parent = RArm
  519.                         bis2.Attachment0 = at2
  520.                         bis2.Attachment1 = at2p2
  521.                         bis2.LimitsEnabled = true
  522.                         bis2.UpperAngle = 15
  523.                         bis2.Visible = vis2
  524.                         bis2.TwistLimitsEnabled = true
  525.                         bis2.UpperAngle = -45
  526.                         bis2.TwistLowerAngle = -45
  527.                         table.insert(js,1,bis2)
  528.                     end
  529.                      if RLeg and not RLeg:FindFirstChild('Dismembered') then
  530.                         local at3 = Instance.new("Attachment")
  531.                         at3.Parent = torso
  532.                         at3.Visible = vis
  533.                         at3.Orientation = torso.Orientation + Vector3.new(90,0,-90)
  534.                         at3.Position = Vector3.new(.5,-1,0)
  535.                                
  536.                         local at3p2 = Instance.new("Attachment")
  537.                         at3p2.Parent = RLeg
  538.                         at3p2.Visible = vis
  539.                         at3p2.Orientation = RLeg.Orientation + Vector3.new(90,0,-90)
  540.                         at3p2.Position = Vector3.new(0,1,0)
  541.                        
  542.                         local bis3 = Instance.new("BallSocketConstraint")
  543.                         bis3.Parent = RLeg
  544.                         bis3.Attachment0 = at3
  545.                         bis3.Attachment1 = at3p2
  546.                         bis3.LimitsEnabled = true
  547.                         bis3.UpperAngle = 180-15
  548.                         bis3.Visible = vis2
  549.                         table.insert(js,1,bis3)
  550.                     end
  551.                          
  552.                     if LLeg and not LLeg:FindFirstChild('Dismembered') then  
  553.                         local at4 = Instance.new("Attachment")
  554.                         at4.Parent = torso
  555.                         at4.Visible = vis
  556.                         at4.Orientation = torso.Orientation + Vector3.new(90,0,-90)
  557.                         at4.Position = Vector3.new(-.5,-1,0)
  558.                                
  559.                         local at4p2 = Instance.new("Attachment")
  560.                         at4p2.Parent = LLeg
  561.                         at4p2.Visible = vis
  562.                         at4p2.Orientation = LLeg.Orientation + Vector3.new(90,0,-90)
  563.                         at4p2.Position = Vector3.new(0,1,0)
  564.                    
  565.                         local bis4 = Instance.new("BallSocketConstraint")
  566.                         bis4.Parent = LLeg
  567.                         bis4.Attachment0 = at4
  568.                         bis4.Attachment1 = at4p2
  569.                         bis4.LimitsEnabled = true
  570.                         bis4.UpperAngle = 180-15
  571.                         bis4.Visible = vis2
  572.                         table.insert(js,1,bis4)
  573.                     end
  574.                    
  575.                     if head and not headless and not head:FindFirstChild('Dismembered') then  
  576.                             local at5 = Instance.new("Attachment")
  577.                             at5.Parent = torso
  578.                             at5.Visible = vis
  579.                             at5.Orientation = torso.Orientation + Vector3.new(180,90,0)
  580.                             at5.Position = Vector3.new(0,1,0)
  581.                          
  582.                             local at5p2 = Instance.new("Attachment")
  583.                             at5p2.Parent = head
  584.                             at5p2.Visible = vis
  585.                             at5p2.Orientation = head.Orientation + Vector3.new(180,90,0)
  586.                             at5p2.Position = Vector3.new(0,-.5,0)
  587.                    
  588.                             local bis5 = Instance.new("BallSocketConstraint")
  589.                             bis5.Parent = head
  590.                             bis5.Attachment0 = at5p2
  591.                             bis5.Attachment1 = at5
  592.                             bis5.LimitsEnabled = true
  593.                             bis5.UpperAngle = 75
  594.                             bis5.Visible = vis2
  595.                             bis5.TwistLimitsEnabled = true
  596.                             bis5.UpperAngle = -45
  597.                             bis5.TwistLowerAngle = -45
  598.                             table.insert(js,1,bis5)
  599.                         else
  600.                             --head:BreakJoints()
  601.                         end
  602.                     end
  603.                 end)
  604.             end
  605.         elseif head and hum then
  606.             hum.BreakJointsOnDeath = false
  607.             if insta then
  608.                 if hum.RigType==Enum.HumanoidRigType.R15 then
  609.                     for _,v in pairs(pc:GetDescendants()) do
  610.                         if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then
  611.                             if not kill then
  612.                                 table.insert(js2,1,{obj = v,par = v.Parent})
  613.                                 v.Parent = nil
  614.                             elseif kill then
  615.                                 v:Destroy()
  616.                             end
  617.                         end
  618.                     end
  619.                     local vis = false
  620.                     local vis2 = false
  621.                        
  622.                     if LF and not LF:FindFirstChild('Dismembered') then  
  623.                         local bsc1 = Instance.new("BallSocketConstraint",LF)
  624.                         bsc1.Attachment0 = LF.LeftAnkleRigAttachment
  625.                         bsc1.Attachment1 = LLL.LeftAnkleRigAttachment
  626.                         table.insert(js,1,bsc1)
  627.                     end
  628.                     if LLL and not LLL:FindFirstChild('Dismembered') then  
  629.                         local bsc2 = Instance.new("BallSocketConstraint",LLL)
  630.                         bsc2.Attachment0 = LLL.LeftKneeRigAttachment
  631.                         bsc2.Attachment1 = LUL.LeftKneeRigAttachment
  632.                         table.insert(js,1,bsc2)
  633.                     end
  634.                     if LUL and not LUL:FindFirstChild('Dismembered') then  
  635.                         local bsc3 = Instance.new("BallSocketConstraint",LUL)
  636.                         bsc3.Attachment0 = LUL.LeftHipRigAttachment
  637.                         bsc3.Attachment1 = LT.LeftHipRigAttachment
  638.                         table.insert(js,1,bsc3)
  639.                     end
  640.                     if RF and not RF:FindFirstChild('Dismembered') then  
  641.                         local bsc4 = Instance.new("BallSocketConstraint",RF)
  642.                         bsc4.Attachment0 = RF.RightAnkleRigAttachment
  643.                         bsc4.Attachment1 = RLL.RightAnkleRigAttachment
  644.                         table.insert(js,1,bsc4)
  645.                     end
  646.                     if RLL and not RLL:FindFirstChild('Dismembered') then  
  647.                         local bsc5 = Instance.new("BallSocketConstraint",RLL)
  648.                         bsc5.Attachment0 = RLL.RightKneeRigAttachment
  649.                         bsc5.Attachment1 = RUL.RightKneeRigAttachment
  650.                         table.insert(js,1,bsc5)
  651.                     end
  652.                     if RUL and not RUL:FindFirstChild('Dismembered') then  
  653.                         local bsc6 = Instance.new("BallSocketConstraint",RUL)
  654.                         bsc6.Attachment0 = RUL.RightHipRigAttachment
  655.                         bsc6.Attachment1 = LT.RightHipRigAttachment
  656.                         table.insert(js,1,bsc6)
  657.                     end
  658.                     if LH and not LH:FindFirstChild('Dismembered') then  
  659.                         local bsc7 = Instance.new("BallSocketConstraint",LH)
  660.                         bsc7.Attachment0 = LH.LeftWristRigAttachment
  661.                         bsc7.Attachment1 = LLA.LeftWristRigAttachment
  662.                         table.insert(js,1,bsc7)
  663.                     end
  664.                     if LLA and not LLA:FindFirstChild('Dismembered') then  
  665.                         local bsc8 = Instance.new("BallSocketConstraint",LLA)
  666.                         bsc8.Attachment0 = LLA.LeftElbowRigAttachment
  667.                         bsc8.Attachment1 = LUA.LeftElbowRigAttachment
  668.                         table.insert(js,1,bsc8)
  669.                     end
  670.                     if LUA and not LUA:FindFirstChild('Dismembered') then  
  671.                         local bsc9 = Instance.new("BallSocketConstraint",LUA)
  672.                         bsc9.Attachment0 = LUA.LeftShoulderAttachment
  673.                         bsc9.Attachment1 = UT.LeftCollarAttachment
  674.                         table.insert(js,1,bsc9)
  675.                     end
  676.                     if RH and not RH:FindFirstChild('Dismembered') then  
  677.                         local bsc10 = Instance.new("BallSocketConstraint",RH)
  678.                         bsc10.Attachment0 = RH.RightWristRigAttachment
  679.                         bsc10.Attachment1 = RLA.RightWristRigAttachment
  680.                         table.insert(js,1,bsc10)
  681.                     end
  682.                     if RLA and not RLA:FindFirstChild('Dismembered') then  
  683.                         local bsc11 = Instance.new("BallSocketConstraint",RLA)
  684.                         bsc11.Attachment0 = RLA.RightElbowRigAttachment
  685.                         bsc11.Attachment1 = RUA.RightElbowRigAttachment
  686.                         table.insert(js,1,bsc11)
  687.                     end
  688.                     if RUA and not RUA:FindFirstChild('Dismembered') then  
  689.                         local bsc12 = Instance.new("BallSocketConstraint",RUA)
  690.                         bsc12.Attachment0 = RUA.RightShoulderAttachment
  691.                         bsc12.Attachment1 = UT.RightCollarAttachment
  692.                         table.insert(js,1,bsc12)
  693.                     end
  694.                     if LT and not LT:FindFirstChild('Dismembered') then  
  695.                         local bsc13 = Instance.new("BallSocketConstraint",LT)
  696.                         bsc13.Attachment0 = LT.WaistRigAttachment
  697.                         bsc13.Attachment1 = UT.WaistRigAttachment
  698.                         table.insert(js,1,bsc13)
  699.                     end
  700.                     if head and not headless and not head:FindFirstChild('Dismembered')  then
  701.                         local bsc14 = Instance.new("BallSocketConstraint",head)
  702.                         bsc14.Attachment0 = UT.NeckRigAttachment
  703.                         bsc14.Attachment1 = head.NeckRigAttachment
  704.                         bsc14.LimitsEnabled = true
  705.                         bsc14.UpperAngle = -75
  706.                         bsc14.TwistLimitsEnabled = true
  707.                         bsc14.UpperAngle = -45
  708.                         bsc14.TwistLowerAngle = -45
  709.                         table.insert(js,1,bsc14)
  710.                     else
  711.                         --head:BreakJoints()
  712.                     end
  713.                 end
  714.             else
  715.                 hum.Died:Connect(function()
  716.                     if hum.RigType==Enum.HumanoidRigType.R15 then
  717.                         for _,v in pairs(pc:GetDescendants()) do
  718.                             if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then
  719.                                 if not kill then
  720.                                     table.insert(js2,1,{obj = v,par = v.Parent})
  721.                                     v.Parent = nil
  722.                                 elseif kill then
  723.                                     v:Destroy()
  724.                                 end
  725.                             end
  726.                         end
  727.                         local vis = false
  728.                         local vis2 = false
  729.                            
  730.                         if LF and not LF:FindFirstChild('Dismembered') then  
  731.                             local bsc1 = Instance.new("BallSocketConstraint",LF)
  732.                             bsc1.Attachment0 = LF.LeftAnkleRigAttachment
  733.                             bsc1.Attachment1 = LLL.LeftAnkleRigAttachment
  734.                             table.insert(js,1,bsc1)
  735.                         end
  736.                         if LLL and not LLL:FindFirstChild('Dismembered') then  
  737.                             local bsc2 = Instance.new("BallSocketConstraint",LLL)
  738.                             bsc2.Attachment0 = LLL.LeftKneeRigAttachment
  739.                             bsc2.Attachment1 = LUL.LeftKneeRigAttachment
  740.                             table.insert(js,1,bsc2)
  741.                         end
  742.                         if LUL and not LUL:FindFirstChild('Dismembered') then  
  743.                             local bsc3 = Instance.new("BallSocketConstraint",LUL)
  744.                             bsc3.Attachment0 = LUL.LeftHipRigAttachment
  745.                             bsc3.Attachment1 = LT.LeftHipRigAttachment
  746.                             table.insert(js,1,bsc3)
  747.                         end
  748.                         if RF and not RF:FindFirstChild('Dismembered') then  
  749.                             local bsc4 = Instance.new("BallSocketConstraint",RF)
  750.                             bsc4.Attachment0 = RF.RightAnkleRigAttachment
  751.                             bsc4.Attachment1 = RLL.RightAnkleRigAttachment
  752.                             table.insert(js,1,bsc4)
  753.                         end
  754.                         if RLL and not RLL:FindFirstChild('Dismembered') then  
  755.                             local bsc5 = Instance.new("BallSocketConstraint",RLL)
  756.                             bsc5.Attachment0 = RLL.RightKneeRigAttachment
  757.                             bsc5.Attachment1 = RUL.RightKneeRigAttachment
  758.                             table.insert(js,1,bsc5)
  759.                         end
  760.                         if RUL and not RUL:FindFirstChild('Dismembered') then  
  761.                             local bsc6 = Instance.new("BallSocketConstraint",RUL)
  762.                             bsc6.Attachment0 = RUL.RightHipRigAttachment
  763.                             bsc6.Attachment1 = LT.RightHipRigAttachment
  764.                             table.insert(js,1,bsc6)
  765.                         end
  766.                         if LH and not LH:FindFirstChild('Dismembered') then  
  767.                             local bsc7 = Instance.new("BallSocketConstraint",LH)
  768.                             bsc7.Attachment0 = LH.LeftWristRigAttachment
  769.                             bsc7.Attachment1 = LLA.LeftWristRigAttachment
  770.                             table.insert(js,1,bsc7)
  771.                         end
  772.                         if LLA and not LLA:FindFirstChild('Dismembered') then  
  773.                             local bsc8 = Instance.new("BallSocketConstraint",LLA)
  774.                             bsc8.Attachment0 = LLA.LeftElbowRigAttachment
  775.                             bsc8.Attachment1 = LUA.LeftElbowRigAttachment
  776.                             table.insert(js,1,bsc8)
  777.                         end
  778.                         if LUA and not LUA:FindFirstChild('Dismembered') then  
  779.                             local bsc9 = Instance.new("BallSocketConstraint",LUA)
  780.                             bsc9.Attachment0 = LUA.LeftShoulderAttachment
  781.                             bsc9.Attachment1 = UT.LeftCollarAttachment
  782.                             table.insert(js,1,bsc9)
  783.                         end
  784.                         if RH and not RH:FindFirstChild('Dismembered') then  
  785.                             local bsc10 = Instance.new("BallSocketConstraint",RH)
  786.                             bsc10.Attachment0 = RH.RightWristRigAttachment
  787.                             bsc10.Attachment1 = RLA.RightWristRigAttachment
  788.                             table.insert(js,1,bsc10)
  789.                         end
  790.                         if RLA and not RLA:FindFirstChild('Dismembered') then  
  791.                             local bsc11 = Instance.new("BallSocketConstraint",RLA)
  792.                             bsc11.Attachment0 = RLA.RightElbowRigAttachment
  793.                             bsc11.Attachment1 = RUA.RightElbowRigAttachment
  794.                             table.insert(js,1,bsc11)
  795.                         end
  796.                         if RUA and not RUA:FindFirstChild('Dismembered') then  
  797.                             local bsc12 = Instance.new("BallSocketConstraint",RUA)
  798.                             bsc12.Attachment0 = RUA.RightShoulderAttachment
  799.                             bsc12.Attachment1 = UT.RightCollarAttachment
  800.                             table.insert(js,1,bsc12)
  801.                         end
  802.                         if LT and not LT:FindFirstChild('Dismembered') then  
  803.                             local bsc13 = Instance.new("BallSocketConstraint",LT)
  804.                             bsc13.Attachment0 = LT.WaistRigAttachment
  805.                             bsc13.Attachment1 = UT.WaistRigAttachment
  806.                             table.insert(js,1,bsc13)
  807.                         end
  808.                         if head and not headless and not head:FindFirstChild('Dismembered')  then
  809.                             local bsc14 = Instance.new("BallSocketConstraint",head)
  810.                             bsc14.Attachment0 = UT.NeckRigAttachment
  811.                             bsc14.Attachment1 = head.NeckRigAttachment
  812.                             bsc14.LimitsEnabled = true
  813.                             bsc14.UpperAngle = -75
  814.                             bsc14.TwistLimitsEnabled = true
  815.                             bsc14.UpperAngle = -45
  816.                             bsc14.TwistLowerAngle = -45
  817.                             table.insert(js,1,bsc14)
  818.                         else
  819.                             --head:BreakJoints()
  820.                         end
  821.                     end
  822.                 end)
  823.             end
  824.         end
  825.     end
  826.     return js,js2
  827. end
  828. function kill(obj,headshot,lookVector)
  829.     local targchar,targhead,targtorso,targhum,killval
  830.     pcall(function()
  831.         targchar = obj.Parent
  832.     end)
  833.     for i,v in pairs(game:GetService("Players"):GetPlayers()) do
  834.         if v and v.Character and obj:IsDescendantOf(v.Character) then
  835.             targchar = v.Character
  836.         end
  837.     end
  838.     pcall(function()
  839.         targtorso = targchar:FindFirstChild("Torso") or targchar:FindFirstChild("UpperTorso") or targchar:FindFirstChild("HumanoidRootPart")
  840.     end)
  841.     pcall(function()
  842.         targhead = targchar:FindFirstChild("Head")
  843.     end)
  844.     pcall(function()
  845.         targhum = targchar:FindFirstChildOfClass("Humanoid")
  846.     end)
  847.     pcall(function()
  848.         killval = targhum:FindFirstChild("killer")
  849.     end)
  850.     pcall(function()
  851.         decapval = targhum:FindFirstChild("decapped " .. targchar.Name)
  852.     end)
  853.     if targchar and targhead and targtorso and targhum and targhum ~= hum and using then
  854.         targhum:TakeDamage(1/0)
  855.         if 0 >= targhum.Health then
  856.             if (not decapval and headshot) or not killval then
  857.                 if not killval then
  858.                     local tempkillval = Instance.new("ObjectValue",targhum)
  859.                     tempkillval.Name = "killer"
  860.                     tempkillval.Value = plr
  861.                 end
  862.                 local kb = 15
  863.                 local bv = Instance.new("BodyVelocity")
  864.                 bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  865.                 bv.Velocity = lookVector*kb+Vector3.new(0,kb,0)
  866.                 bv.Parent = targtorso
  867.                 game:GetService("Debris"):AddItem(bv,0.1)
  868.                 local ragval = Instance.new("ObjectValue")
  869.                 ragval.Name = 'Ragdolled'
  870.                 ragval.Parent = targhum
  871.                 Ragdoll(targchar,headshot,true,true)
  872.                 --bleed2(targtorso,targhum,true,5,true)
  873.             end
  874.             if headshot and not decapval then
  875.                 local tempdecapval = Instance.new("ObjectValue",targhum)
  876.                 tempdecapval.Name = ("decapped " .. targchar.Name)
  877.                 --[[
  878.                 local decap_bleed = Instance.new("Sound")
  879.                 decap_bleed.SoundId = 'rbxassetid://244502094'
  880.                 decap_bleed.Volume = 0.5
  881.                 decap_bleed.Parent = targtorso
  882.                 decap_bleed:Play()
  883.                 local decap_head = Instance.new("Sound")
  884.                 decap_head.SoundId = 'rbxassetid://1255040462' --222406108
  885.                 decap_head.Volume = 1
  886.                 decap_head.Parent = targtorso
  887.                 decap_head:Play()
  888.                 ]]
  889.                 remote:FireClient(plr,1,'rbxassetid://244502094',nil,0.5,targtorso)
  890.                 remote:FireClient(plr,1,'rbxassetid://1255040462',nil,1,targtorso)
  891.                 local att = Instance.new("Attachment")
  892.                 att.Parent = targtorso
  893.                 att.Position = Vector3.new(0,targtorso.Size.Y/2,0)
  894.                 local blood_emitter = Instance.new("ParticleEmitter")
  895.                 blood_emitter.Name = "Blood2"
  896.                 blood_emitter.Parent = att
  897.                 blood_emitter.Speed = NumberRange.new(5, 14)
  898.                 blood_emitter.Color = ColorSequence.new(Color3.new(0.45098, 0, 0),Color3.new(0.45098, 0, 0))
  899.                 blood_emitter.LightEmission = 0.20000000298023
  900.                 blood_emitter.LightInfluence = 1
  901.                 blood_emitter.Texture = "http://www.roblox.com/asset/?id=134531274"
  902.                 blood_emitter.Transparency = NumberSequence.new(0.30000001192093,0.30000001192093)
  903.                 blood_emitter.ZOffset = 0
  904.                 blood_emitter.Size = NumberSequence.new(0.12499988079071,0)
  905.                 blood_emitter.Acceleration = Vector3.new(0, -20, 0)
  906.                 blood_emitter.Lifetime = NumberRange.new(0.5, 1.5)
  907.                 blood_emitter.Rate = 100000
  908.                 blood_emitter.SpreadAngle = Vector2.new(90, 90)
  909.                 blood_emitter.VelocitySpread = 90
  910.                 blood_emitter.Enabled = true
  911.                 spawn(function()
  912.                     wait(5)
  913.                     blood_emitter.Enabled = false
  914.                     game:GetService("Debris"):AddItem(blood_emitter,2)
  915.                 end)
  916.             end
  917.         end
  918.     end
  919. end
  920. function bleed2(frick,targhum,can_hurt,t,splat)
  921.     --spawn(function()
  922.     if not frick:FindFirstChild("bleeding from kry's " .. gun.Name) then else return end
  923.     local tempbleedval = Instance.new("ObjectValue")
  924.     tempbleedval.Name = "bleeding from kry's " .. gun.Name
  925.     tempbleedval.Parent = frick
  926.     local bleeding = true
  927.     local rig = targhum.RigType
  928.     local limbs = {'Head','Left Arm','Right Arm','Left Leg','Right Leg','RightUpperLeg','LeftUpperLeg','RightUpperArm','LeftUpperArm','RightLowerLeg','LeftLowerLeg','RightLowerArm','LeftLowerArm','RightFoot','LeftFoot','RightHand','LeftHand'}
  929.     spawn(function()
  930.         wait(t)
  931.         bleeding = false
  932.         tempbleedval:Destroy()
  933.     end)
  934.     while bleeding and frick and frick.Parent do
  935.         if --[[(targhum and targhum.Parent and targhum.Health > 0) or]] (not frick or not frick.Parent or not targhum or not targhum.Parent) then
  936.             break
  937.         end
  938.         local max_limbs = 0
  939.         local current_limbs = 0
  940.         local gone_limbs = 0
  941.         local targchar = targhum.Parent
  942.         if rig == Enum.HumanoidRigType.R6 then
  943.             max_limbs = 5
  944.         elseif rig == Enum.HumanoidRigType.R15 then
  945.             max_limbs = 13
  946.         end
  947.         for i,v in pairs(targchar:GetChildren()) do
  948.             local found = false
  949.             for i,n in pairs(limbs) do if n == v.Name then found = true; end; end;
  950.             if found and not v:FindFirstChild("Dismembered") then
  951.                 current_limbs = current_limbs + 1
  952.             end
  953.         end
  954.         gone_limbs = (max_limbs-current_limbs)
  955.         if targhum and can_hurt then
  956.             if gone_limbs >= 1 then
  957.                 targhum:TakeDamage(0.5*gone_limbs)
  958.             else
  959.                 targhum:TakeDamage(0.5)
  960.             end
  961.         end
  962.         spawn(function()
  963.             local thing = Instance.new('Part')
  964.             thing.Parent = workspace
  965.             thing.Size = Vector3.new(0.1,0.1,0.1)
  966.             thing.CFrame = frick.CFrame*CFrame.new(0,frick.Size.Y/2,0)
  967.             if splat then
  968.                 thing.Transparency = 0
  969.             elseif not splat then
  970.                 thing.Transparency = 1
  971.             end
  972.             thing.Color = Color3.fromRGB(75, 0, 0)
  973.             thing.Material = Enum.Material.Glass
  974.             thing.Name = "blood_drop"
  975.             thing.CanCollide =false
  976.             thing:BreakJoints()
  977.             local mesh = Instance.new('SpecialMesh')
  978.             mesh.MeshType = Enum.MeshType.Sphere
  979.             mesh.Parent = thing
  980.             --game:GetService("Debris"):AddItem(thing,5)
  981.             local att1,att2 = Instance.new("Attachment"),Instance.new("Attachment")
  982.             att1.Parent = thing
  983.             att1.Position = Vector3.new(0,-(thing.Size.Y/2),0)
  984.             att2.Parent = thing
  985.             att2.Position = Vector3.new(0,(thing.Size.Y/2),0)
  986.             if splat then
  987.                 local trail_drop = Instance.new("Trail")
  988.                 trail_drop.Parent = thing
  989.                 trail_drop.Attachment0 = att1
  990.                 trail_drop.Attachment1 = att2
  991.                 trail_drop.Color = ColorSequence.new(Color3.new(0.294118, 0, 0),Color3.new(0.294118, 0, 0))
  992.                 trail_drop.FaceCamera = true
  993.                 trail_drop.LightInfluence = 1
  994.                 trail_drop.Transparency = NumberSequence.new(0.1,1)
  995.                 trail_drop.Lifetime = 1
  996.                 trail_drop.MinLength = 0
  997.             end
  998.             local rawrxd = Instance.new('BodyForce')
  999.             rawrxd.Parent = thing
  1000.             if splat then
  1001.                 rawrxd.Force = frick.CFrame.upVector+Vector3.new(math.random(-5, 5)/10,3,math.random(-5, 5)/10)
  1002.             elseif not splat then
  1003.                 rawrxd.Force = frick.CFrame.upVector*(math.random()*2)+Vector3.new(math.random(-5, 5)/10,1.5,0)
  1004.             end
  1005.             game:GetService("Debris"):AddItem(rawrxd,0.01)
  1006.             thing.Touched:connect(function(tou)
  1007.                 if tou and tou.Parent and not tou:IsDescendantOf(targchar) and not tou.Parent:FindFirstChildOfClass("Humanoid") and not tou.Parent.Parent:FindFirstChildOfClass("Humanoid") and not tou.Parent:IsA("Accessory") and tou.Name ~= 'Handle' and tou.Parent.Name ~= 'Handle' and not tou.Parent:IsA("Tool") and not string.match(tou.Name:lower(),'blood_drop') and not string.match(tou.Name:lower(),'bullet') and not string.match(tou.Name:lower(),'bone') and not string.match(tou.Name:lower(),'gun mag') and not string.match(tou.Name:lower(),'limb') then
  1008.                     local pos = Vector3.new(thing.Position.X,(tou.Position.Y+(tou.Size.Y/2))+(0.02/2),thing.Position.Z)
  1009.                     local Point1 = pos-Vector3.new(0.01,0.01,0.01)
  1010.                     local Point2 = pos+Vector3.new(0.01,0.01,0.01)
  1011.                     local Region = Region3.new(Point1,Point2)
  1012.                     for _,Part in pairs(game.Workspace:FindPartsInRegion3(Region,nil,math.huge)) do
  1013.                         if Part.Name == "blood" then
  1014.                             tou = Part
  1015.                         end
  1016.                     end
  1017.                     thing:Destroy()
  1018.                     if tou.Name == "blood" then
  1019.                         local reee = tou.CFrame
  1020.                         if tou.Transparency > -0.2 then
  1021.                             tou.Transparency = tou.Transparency - 0.1
  1022.                         end
  1023.                         if tou.Size.X < 5 then
  1024.                             tou.Size = tou.Size+Vector3.new(0.4,0,0.4)
  1025.                             tou.CFrame = reee
  1026.                         elseif tou.Size.X < 7.5 then
  1027.                             tou.Size = tou.Size+Vector3.new(0.3,0,0.3)
  1028.                             tou.CFrame = reee
  1029.                         elseif tou.Size.X < 10 then
  1030.                             tou.Size = tou.Size+Vector3.new(0.2,0,0.2)
  1031.                             tou.CFrame = reee
  1032.                         end
  1033.                     elseif tou.CanCollide == true then
  1034.                         local bloodlol = Instance.new('Part')
  1035.                         if gone_limbs >= 1 then
  1036.                             bloodlol.Size = Vector3.new(1*gone_limbs,0.2,1*gone_limbs)
  1037.                         else
  1038.                             bloodlol.Size = Vector3.new(1,0.2,1)
  1039.                         end
  1040.                         bloodlol.Name = "blood"
  1041.                         bloodlol.Anchored = true
  1042.                         bloodlol.CanCollide = false
  1043.                         bloodlol.Material = Enum.Material.Glass
  1044.                         bloodlol.Color = Color3.fromRGB(75, 0, 0)
  1045.                         local mesh = Instance.new('SpecialMesh')
  1046.                         mesh.MeshType = Enum.MeshType.Sphere
  1047.                         mesh.Parent = bloodlol
  1048.                         bloodlol.Parent = workspace
  1049.                         bloodlol.CFrame = CFrame.new(pos)
  1050.                         while bloodlol and bloodlol.Parent ~= nil do
  1051.                             if bloodlol.Transparency < 1 then
  1052.                                 bloodlol.Transparency = bloodlol.Transparency + 0.05
  1053.                             else
  1054.                                 bloodlol:Destroy()
  1055.                             end
  1056.                             wait(0.1)
  1057.                         end
  1058.                     end
  1059.                 end
  1060.             end)
  1061.         end)
  1062.         wait(0.1)
  1063.     end
  1064.     tempbleedval:Destroy()
  1065.     --end)
  1066. end
  1067.  
  1068. function Reload()
  1069.     if max_ammo > ammo then else return end
  1070.     using = true
  1071.     reload_s:Play()
  1072.     local mag = Instance.new("Part")
  1073.     mag.Name = 'gun mag'
  1074.     mag.Size = Vector3.new(0.53, 0.94, 0.23)
  1075.     mag.Color = han.Color
  1076.     mag.Parent = nil
  1077.     mag.CFrame = han.CFrame * CFrame.new(0.7,0,0)
  1078.     debris:AddItem(mag,10)
  1079.     repeat wait() until not reload_s.IsPlaying
  1080.     ammo = max_ammo
  1081.     game:GetService("Debris"):AddItem(mag,10)
  1082.     using = false
  1083. end
  1084.  
  1085. function breakwindow(hit)
  1086.     if hit and not string.match(hit.Name:lower(),"window shatter") and not string.match(hit.Name:lower(),"blood") then else return end
  1087.     local wbreakc = wbreak:Clone()
  1088.     wbreakc.Parent = hit
  1089.     wbreakc:Play()
  1090.     local sx,sy,sz=hit.Size.x,hit.Size.y,hit.Size.z
  1091.     hit.Name = "window shatter"
  1092.     for x=1,4 do
  1093.         for y=1,4 do
  1094.             local part=hit:Clone()
  1095.             local position=Vector3.new(x-2.1,y-2.1,0)*Vector3.new(sx/4,sy/4,sz)
  1096.             part.Size=Vector3.new(sx/4,sy/4,sz)
  1097.             part.CFrame=hit.CFrame*(CFrame.new(part.Size/8)-hit.Size/8+position)           
  1098.             part.Velocity=Vector3.new(math.random(-10,10),math.random(-10,10),math.random(-10,10))
  1099.             part.Name="window shatter"
  1100.             part.Parent=hit.Parent
  1101.             debris:AddItem(part,2)
  1102.             spawn(function()
  1103.                 wait(0.5)
  1104.                 for i=1,10 do
  1105.                     part.Transparency=part.Transparency+0.05
  1106.                     wait(0.05)
  1107.                 end
  1108.                 part:Destroy()
  1109.             end)
  1110.             part.Anchored=false
  1111.         end
  1112.     end
  1113.     hit:Destroy()
  1114. end
  1115.  
  1116. function raycast(Pos,Dir,Max,Ignore)
  1117.     return workspace:FindPartOnRayWithIgnoreList(Ray.new(Pos, Dir * (Max or 999.999)), (Ignore or {}), false, true)
  1118. end
  1119.  
  1120. local objhit = {}
  1121. local oldobjhit = {}
  1122.  
  1123. function make_hole(pos,obj,col)
  1124.     local BulletHolePart = Instance.new("Part")
  1125.     BulletHolePart.Massless = true
  1126.     BulletHolePart.Anchored = false
  1127.     BulletHolePart.CanCollide = false
  1128.     BulletHolePart.Locked = true
  1129.     BulletHolePart.FormFactor = "Custom"
  1130.     BulletHolePart.TopSurface, BulletHolePart.BottomSurface, BulletHolePart.RightSurface, BulletHolePart.LeftSurface, BulletHolePart.FrontSurface, BulletHolePart.BackSurface = "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines", "SmoothNoOutlines"
  1131.     BulletHolePart.Name = "Bullet Hole"
  1132.     BulletHolePart.Material = "Plastic"
  1133.     BulletHolePart.Reflectance = 0
  1134.     BulletHolePart.Transparency = 1
  1135.     BulletHolePart.BrickColor = BrickColor.new("Medium stone grey")
  1136.     BulletHolePart.Size = Vector3.new(0.3, 0, 0.3)
  1137.     BulletHolePart:BreakJoints()
  1138.     BulletHolePart.CFrame = pos
  1139.     BulletHolePart.Parent = script
  1140.     local weld = Instance.new("WeldConstraint")
  1141.     weld.Part0 = obj
  1142.     weld.Part1 = BulletHolePart
  1143.     weld.Parent = obj
  1144.    -- game:GetService("Debris"):AddItem(BulletHolePart, 5)
  1145.     --[[
  1146.     local BulletHoleDecal = Instance.new("Decal")
  1147.     BulletHoleDecal.Color3 = Color3.new(col.r, col.g, col.b)
  1148.     BulletHoleDecal.Face = "Top"
  1149.     BulletHoleDecal.Texture = "rbxassetid://359667865"
  1150.     BulletHoleDecal.Transparency = 0
  1151.     BulletHoleDecal.Parent = BulletHolePart
  1152.     ]]
  1153.     remote:FireClient(plr,2,"rbxassetid://359667865","Top",0,BulletHolePart)
  1154.     return BulletHolePart
  1155. end
  1156.  
  1157. local blood_images = {931617584,1663434319,1391189545,4533673847,3236192667,2565888666,612591729,120362139,116830967,122022304,131339257,247766282,121678640,176677800,120361912,176678070,176678086,176677869} --305296807,256293532,148713503,176678030
  1158.  
  1159. local e_s = 1
  1160.  
  1161. function add_decal(f,t,obj)
  1162.     --spawn(function()
  1163.     local texture = Instance.new("Texture")
  1164.     texture.Parent = obj
  1165.     texture.Face = f
  1166.     texture.Texture = 'rbxassetid://' .. t
  1167.     if f == 'Left' or f == 'Right' then
  1168.         texture.StudsPerTileV = obj.Size.Y + e_s
  1169.         if (obj.Size.X > obj.Size.Z) then
  1170.             texture.StudsPerTileV = obj.Size.Z + e_s
  1171.         elseif (obj.Size.Z > obj.Size.X) then
  1172.             texture.StudsPerTileU = obj.Size.X + e_s
  1173.         else
  1174.             texture.StudsPerTileU = obj.Size.X + e_s
  1175.         end
  1176.     elseif f == 'Front' or f == 'Back' then
  1177.         texture.StudsPerTileV = obj.Size.Y + e_s
  1178.         if (obj.Size.X > obj.Size.Z) then
  1179.             texture.StudsPerTileV = obj.Size.X + e_s
  1180.         elseif (obj.Size.Z > obj.Size.X) then
  1181.             texture.StudsPerTileU = obj.Size.Z + e_s
  1182.         else
  1183.             texture.StudsPerTileU = obj.Size.X + e_s
  1184.         end
  1185.     elseif f == 'Top' or f == 'Bottom' then
  1186.         texture.StudsPerTileV = obj.Size.X + e_s
  1187.         texture.StudsPerTileU = obj.Size.Z + e_s
  1188.     end
  1189.     --end)
  1190. end
  1191.  
  1192. function add_blood(obj)
  1193.     local t1,t2,t3,t4,t5,t6 = blood_images[math.random(1,#blood_images)],blood_images[math.random(1,#blood_images)],blood_images[math.random(1,#blood_images)],blood_images[math.random(1,#blood_images)],blood_images[math.random(1,#blood_images)],blood_images[math.random(1,#blood_images)]
  1194.     add_decal('Top',t1,obj)
  1195.     add_decal('Bottom',t2,obj)
  1196.     add_decal('Left',t3,obj)
  1197.     add_decal('Right',t4,obj)
  1198.     add_decal('Front',t5,obj)
  1199.     add_decal('Back',t6,obj)
  1200. end
  1201.  
  1202. function make_bone(obj,targtorso)
  1203.     if obj.Name == 'Left Arm' or obj.Name == 'LeftUpperArm' then
  1204.         local bone = Instance.new("Part")
  1205.         bone.name = 'bone'
  1206.         bone.CanCollide = false
  1207.         bone.Anchored = false
  1208.         bone.CFrame = targtorso.CFrame
  1209.         bone.Size = targtorso.Size
  1210.         bone.Massless = true
  1211.         bone.Locked = true
  1212.         local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  1213.         if not exists then
  1214.             game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  1215.         end
  1216.         game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  1217.         game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
  1218.         game:GetService("PhysicsService"):SetPartCollisionGroup(targtorso,'Limb Collide')
  1219.         local weld = Instance.new("Weld")
  1220.         weld.Part0 = bone
  1221.         weld.Part1 = targtorso
  1222.         weld.C1 = CFrame.new(-0.61,0.77,0.03)*CFrame.Angles(math.rad(90),0,math.rad(90))
  1223.         weld.Parent = bone
  1224.         targtorso.Anchored = false
  1225.         bone.Parent = script
  1226.         local mesh = Instance.new("SpecialMesh")
  1227.         mesh.MeshId = 'rbxassetid://1076136382'
  1228.         mesh.TextureId = 'rbxassetid://1076137938'
  1229.         mesh.Scale = Vector3.new(0.03,0.03,0.03)
  1230.         mesh.Parent = bone
  1231.         --
  1232.         local bone = Instance.new("Part")
  1233.         bone.Name = 'bone'
  1234.         bone.CanCollide = false
  1235.         bone.Anchored = false
  1236.         bone.CFrame = obj.CFrame
  1237.         bone.Size = obj.Size
  1238.         bone.Massless = true
  1239.         bone.Locked = true
  1240.         local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  1241.         if not exists then
  1242.             game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  1243.         end
  1244.         game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  1245.         game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
  1246.         game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
  1247.         local weld = Instance.new("Weld")
  1248.         weld.Part0 = bone
  1249.         weld.Part1 = obj
  1250.         weld.C1 = CFrame.new(0.13,0.26,0)
  1251.         weld.Parent = bone
  1252.         obj.Anchored = false
  1253.         bone.Parent = script
  1254.         local mesh = Instance.new("SpecialMesh")
  1255.         mesh.MeshId = 'rbxassetid://36780032'
  1256.         mesh.TextureId = 'rbxassetid://36780292'
  1257.         mesh.Parent = bone
  1258.     elseif obj.Name == 'Right Arm' or obj.Name == 'RightUpperArm' then
  1259.         local bone = Instance.new("Part")
  1260.         bone.Name = 'bone'
  1261.         bone.CanCollide = false
  1262.         bone.Anchored = false
  1263.         bone.CFrame = targtorso.CFrame
  1264.         bone.Size = targtorso.Size
  1265.         bone.Massless = true
  1266.         bone.Locked = true
  1267.         local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  1268.         if not exists then
  1269.             game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  1270.         end
  1271.         game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  1272.         game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
  1273.         game:GetService("PhysicsService"):SetPartCollisionGroup(targtorso,'Limb Collide')
  1274.         local weld = Instance.new("Weld")
  1275.         weld.Part0 = bone
  1276.         weld.Part1 = targtorso
  1277.         weld.C1 = CFrame.new(0.61,0.77,0.03)*CFrame.Angles(math.rad(90),0,math.rad(-90))
  1278.         weld.Parent = bone
  1279.         targtorso.Anchored = false
  1280.         bone.Parent = script
  1281.         local mesh = Instance.new("SpecialMesh")
  1282.         mesh.MeshId = 'rbxassetid://1076136382'
  1283.         mesh.TextureId = 'rbxassetid://1076137938'
  1284.         mesh.Scale = Vector3.new(0.03,0.03,0.03)
  1285.         mesh.Parent = bone
  1286.         --
  1287.         local bone = Instance.new("Part")
  1288.         bone.Name = 'bone'
  1289.         bone.CanCollide = false
  1290.         bone.Anchored = false
  1291.         bone.CFrame = obj.CFrame
  1292.         bone.Size = obj.Size
  1293.         bone.Massless = true
  1294.         bone.Locked = true
  1295.         local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  1296.         if not exists then
  1297.             game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  1298.         end
  1299.         game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  1300.         game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
  1301.         game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
  1302.         local weld = Instance.new("Weld")
  1303.         weld.Part0 = bone
  1304.         weld.Part1 = obj
  1305.         weld.C1 = CFrame.new(-0.13,0.26,0)
  1306.         weld.Parent = bone
  1307.         obj.Anchored = false
  1308.         bone.Parent = script
  1309.         local mesh = Instance.new("SpecialMesh")
  1310.         mesh.MeshId = 'rbxassetid://36780156'
  1311.         mesh.TextureId = 'rbxassetid://36780292'
  1312.         mesh.Parent = bone
  1313.     elseif obj.Name == 'Left Leg' or obj.Name == 'LeftUpperLeg' then
  1314.         local bone = Instance.new("Part")
  1315.         bone.Name = 'bone'
  1316.         bone.CanCollide = false
  1317.         bone.Anchored = false
  1318.         bone.CFrame = targtorso.CFrame
  1319.         bone.Size = targtorso.Size
  1320.         bone.Massless = true
  1321.         bone.Locked = true
  1322.         local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  1323.         if not exists then
  1324.             game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  1325.         end
  1326.         game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  1327.         game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
  1328.         game:GetService("PhysicsService"):SetPartCollisionGroup(targtorso,'Limb Collide')
  1329.         local weld = Instance.new("Weld")
  1330.         weld.Part0 = bone
  1331.         weld.Part1 = targtorso
  1332.         weld.C1 = CFrame.new(-0.6,-0.64,0.11)*CFrame.Angles(0,0,math.rad(180))
  1333.         weld.Parent = bone
  1334.         targtorso.Anchored = false
  1335.         bone.Parent = script
  1336.         local mesh = Instance.new("SpecialMesh")
  1337.         mesh.MeshId = 'rbxassetid://1076136382'
  1338.         mesh.TextureId = 'rbxassetid://1076137938'
  1339.         mesh.Scale = Vector3.new(0.03,0.03,0.03)
  1340.         mesh.Parent = bone
  1341.         --
  1342.         local bone = Instance.new("Part")
  1343.         bone.Name = 'bone'
  1344.         bone.CanCollide = false
  1345.         bone.Anchored = false
  1346.         bone.CFrame = obj.CFrame
  1347.         bone.Size = obj.Size
  1348.         bone.Massless = true
  1349.         bone.Locked = true
  1350.         local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  1351.         if not exists then
  1352.             game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  1353.         end
  1354.         game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  1355.         game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
  1356.         game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
  1357.         local weld = Instance.new("Weld")
  1358.         weld.Part0 = bone
  1359.         weld.Part1 = obj
  1360.         weld.C1 = CFrame.new(0,0.09,0.13)
  1361.         weld.Parent = bone
  1362.         obj.Anchored = false
  1363.         bone.Parent = script
  1364.         local mesh = Instance.new("SpecialMesh")
  1365.         mesh.MeshId = 'rbxassetid://36780156'
  1366.         mesh.TextureId = 'rbxassetid://36780292'
  1367.         mesh.Parent = bone
  1368.     elseif obj.Name == 'Right Leg' or obj.Name == 'RightUpperLeg' then
  1369.         local bone = Instance.new("Part")
  1370.         bone.Name = 'bone'
  1371.         bone.CanCollide = false
  1372.         bone.Anchored = false
  1373.         bone.CFrame = targtorso.CFrame
  1374.         bone.Size = targtorso.Size
  1375.         bone.Massless = true
  1376.         bone.Locked = true
  1377.         local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  1378.         if not exists then
  1379.             game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  1380.         end
  1381.         game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  1382.         game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
  1383.         game:GetService("PhysicsService"):SetPartCollisionGroup(targtorso,'Limb Collide')
  1384.         local weld = Instance.new("Weld")
  1385.         weld.Part0 = bone
  1386.         weld.Part1 = targtorso
  1387.         weld.C1 = CFrame.new(0.6,-0.64,0.11)*CFrame.Angles(0,0,math.rad(180))
  1388.         weld.Parent = bone
  1389.         targtorso.Anchored = false
  1390.         bone.Parent = script
  1391.         local mesh = Instance.new("SpecialMesh")
  1392.         mesh.MeshId = 'rbxassetid://1076136382'
  1393.         mesh.TextureId = 'rbxassetid://1076137938'
  1394.         mesh.Scale = Vector3.new(0.03,0.03,0.03)
  1395.         mesh.Parent = bone
  1396.         --
  1397.         local bone = Instance.new("Part")
  1398.         bone.Name = 'bone'
  1399.         bone.CanCollide = false
  1400.         bone.Anchored = false
  1401.         bone.CFrame = obj.CFrame
  1402.         bone.Size = obj.Size
  1403.         bone.Massless = true
  1404.         bone.Locked = true
  1405.         local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  1406.         if not exists then
  1407.             game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  1408.         end
  1409.         game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  1410.         game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
  1411.         game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
  1412.         local weld = Instance.new("Weld")
  1413.         weld.Part0 = bone
  1414.         weld.Part1 = obj
  1415.         weld.C1 = CFrame.new(0,0.09,0.13)
  1416.         weld.Parent = bone
  1417.         obj.Anchored = false
  1418.         bone.Parent = script
  1419.         local mesh = Instance.new("SpecialMesh")
  1420.         mesh.MeshId = 'rbxassetid://36780195'
  1421.         mesh.TextureId = 'rbxassetid://36780292'
  1422.         mesh.Parent = bone
  1423.     elseif obj.Name == 'Head' then
  1424.         local bone = Instance.new("Part")
  1425.         bone.Name = 'bone'
  1426.         bone.CanCollide = false
  1427.         bone.Anchored = false
  1428.         bone.CFrame = targtorso.CFrame
  1429.         bone.Size = targtorso.Size
  1430.         bone.Massless = true
  1431.         bone.Locked = true
  1432.         local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  1433.         if not exists then
  1434.             game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  1435.         end
  1436.         game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  1437.         game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
  1438.         game:GetService("PhysicsService"):SetPartCollisionGroup(targtorso,'Limb Collide')
  1439.         local weld = Instance.new("Weld")
  1440.         weld.Part0 = bone
  1441.         weld.Part1 = targtorso
  1442.         weld.C1 = CFrame.new(0,0.66,0)
  1443.         weld.Parent = bone
  1444.         targtorso.Anchored = false
  1445.         bone.Parent = script
  1446.         local mesh = Instance.new("SpecialMesh")
  1447.         mesh.MeshId = 'rbxassetid://1076136382'
  1448.         mesh.TextureId = 'rbxassetid://1076137938'
  1449.         mesh.Scale = Vector3.new(0.03,0.03,0.03)
  1450.         mesh.Parent = bone
  1451.         --
  1452.         local bone = Instance.new("Part")
  1453.         bone.Name = 'bone'
  1454.         bone.CanCollide = false
  1455.         bone.Anchored = false
  1456.         bone.CFrame = obj.CFrame
  1457.         bone.Size = obj.Size
  1458.         bone.Massless = true
  1459.         bone.Locked = true
  1460.         local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  1461.         if not exists then
  1462.             game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  1463.         end
  1464.         game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  1465.         game:GetService("PhysicsService"):SetPartCollisionGroup(bone,'Limb Collide')
  1466.         game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
  1467.         local weld = Instance.new("Weld")
  1468.         weld.Part0 = bone
  1469.         weld.Part1 = obj
  1470.         weld.C1 = CFrame.new(0,-0.23,0)*CFrame.Angles(0,math.rad(-90),0)
  1471.         weld.Parent = bone
  1472.         obj.Anchored = false
  1473.         bone.Parent = script
  1474.         local mesh = Instance.new("SpecialMesh")
  1475.         mesh.MeshId = 'rbxassetid://1076136382'
  1476.         mesh.TextureId = 'rbxassetid://1076137938'
  1477.         mesh.Scale = Vector3.new(0.03,0.03,0.03)
  1478.         mesh.Parent = bone
  1479.     end
  1480. end
  1481.  
  1482. function break_limb(obj,rig,targtorso,targhum)
  1483.     if not obj:FindFirstChild('Dismembered') and obj.Name ~= 'Torso' and obj.Name ~= 'HumanoidRootPart' and obj.Name ~= 'UpperTorso' and obj.Name ~= 'LowerTorso' then else return end
  1484.     local confirm = Instance.new("ObjectValue")
  1485.     confirm.Name = 'Dismembered'
  1486.     confirm.Parent = obj
  1487.     local bsc = obj:FindFirstChildOfClass("BallSocketConstraint")
  1488.     if bsc then
  1489.         bsc:Destroy()
  1490.     end
  1491.     --bleed2(obj,targhum,false,5,false)
  1492.     add_blood(obj)
  1493.     make_bone(obj,targtorso)
  1494.     local kb = 15
  1495.     local bv = Instance.new("BodyVelocity")
  1496.     bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  1497.     bv.Velocity = han.CFrame.lookVector*kb+Vector3.new(0,kb,0)
  1498.     bv.Parent = obj
  1499.     game:GetService("Debris"):AddItem(bv,0.1)
  1500.     if rig == Enum.HumanoidRigType.R6 then
  1501.         local bsc = obj:FindFirstChildOfClass("BallSocketConstraint")
  1502.         if bsc then
  1503.             bsc:Destroy()
  1504.         end
  1505.         for i,v in pairs(targtorso:GetChildren()) do
  1506.             if v:IsA("Motor6D") then
  1507.                 if obj.Name == 'Head' and v.Name == 'Neck' then
  1508.                     v:Destroy()
  1509.                 elseif obj.Name == 'Left Arm' and v.Name == 'Left Shouldver' then
  1510.                     v:Destroy()
  1511.                 elseif obj.Name == 'Right Arm' and v.Name == 'Right Shoulder' then
  1512.                     v:Destroy()
  1513.                 elseif obj.Name == 'Left Leg' and v.Name == 'Left Hip' then
  1514.                     if obj.Parent:FindFirstChild("Right Leg") then
  1515.                         targhum.WalkSpeed = targhum.WalkSpeed/2
  1516.                     else
  1517.                         targhum.WalkSpeed = 0
  1518.                     end
  1519.                     v:Destroy()
  1520.                 elseif obj.Name == 'Right Leg' and v.Name == 'Right Hip' then
  1521.                     if obj.Parent:FindFirstChild("Left Leg") then
  1522.                         targhum.WalkSpeed = targhum.WalkSpeed/2
  1523.                     else
  1524.                         targhum.WalkSpeed = 0
  1525.                     end
  1526.                     v:Destroy()
  1527.                 end
  1528.             end
  1529.         end
  1530.     elseif rig == Enum.HumanoidRigType.R15 then
  1531.         for i,v in pairs(obj:GetChildren()) do
  1532.             if v:IsA("Motor6D") then
  1533.                 if (obj.Name == 'LeftUpperLeg' and obj.Parent:FindFirstChild("RightUpperLeg")) or (obj.Name == 'RightUpperLeg' and obj.Parent:FindFirstChild("LeftUpperLeg")) then
  1534.                     targhum.WalkSpeed = targhum.WalkSpeed/2
  1535.                 elseif obj.Name == 'RightUpperLeg' or obj.Name == 'LeftUpperLeg' then
  1536.                     targhum.WalkSpeed = 0
  1537.                 end
  1538.                 v:Destroy()
  1539.             end
  1540.         end
  1541.     end
  1542.     local cb = Instance.new("Part")
  1543.     cb.Name = 'limb'
  1544.     cb.Transparency = 1
  1545.     cb.CanCollide = true
  1546.     cb.Anchored = false
  1547.     cb.CFrame = obj.CFrame
  1548.     cb.Size = obj.Size
  1549.     cb.Massless = true
  1550.     cb.Locked = true
  1551.     local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  1552.     if not exists then
  1553.         game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  1554.     end
  1555.     game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  1556.     game:GetService("PhysicsService"):SetPartCollisionGroup(cb,'Limb Collide')
  1557.     game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
  1558.     local weld = Instance.new("Weld")
  1559.     weld.Part0 = cb
  1560.     weld.Part1 = obj
  1561.     weld.Parent = cb
  1562.     obj.Massless = true
  1563.     obj.Anchored = false
  1564.     cb.Parent = script
  1565. end
  1566.  
  1567. function check(toughness,e1,objpos,p,rays,e3) -- toughness,obj,objpos,p,rays,rot
  1568.     local plrhit = false
  1569.     local rg = Region3.new(objpos-Vector3.new(5,5,5),objpos+Vector3.new(5,5,5))
  1570.     local objs = workspace:FindPartsInRegion3WithIgnoreList(rg,{gun,script})
  1571.     for i,obj in pairs(objs) do
  1572.         if obj and not obj:FindFirstChild('Dismembered') then else continue; end;
  1573.         local targchar,targtorso,targhum,targhead
  1574.         pcall(function()
  1575.             targchar = obj.Parent
  1576.         end)
  1577.         for i,v in pairs(game:GetService("Players"):GetPlayers()) do
  1578.             if v and v.Character and obj:IsDescendantOf(v.Character) then
  1579.                 targchar = v.Character
  1580.             end
  1581.         end
  1582.         pcall(function()
  1583.             targtorso = targchar:FindFirstChild("Torso") or targchar:FindFirstChild("UpperTorso") or targchar:FindFirstChild("HumanoidRootPart")
  1584.         end)
  1585.         pcall(function()
  1586.             targhum = targchar:FindFirstChildOfClass("Humanoid")
  1587.         end)
  1588.         pcall(function()
  1589.             targhead = targchar:FindFirstChild("Head")
  1590.         end)
  1591.         if targchar and targchar.Parent and targtorso and targtorso.Parent and targhum and targhum.Parent and targhead and targhead.Parent and not targhum:FindFirstChild("hit " .. targchar.Name .. " with " .. gun.Name .. " by " .. plr.Name) then
  1592.             plrhit = true
  1593.             local confirm = Instance.new("IntValue")
  1594.             confirm.Parent = targhum
  1595.             confirm.Name = ("hit " .. targchar.Name .. " with " .. gun.Name .. " by " .. plr.Name)
  1596.             debris:AddItem(confirm,shootwait)
  1597.             local dmg = math.abs(1300-1300*((objpos-obj.Position).Magnitude/8.67))
  1598.             if 300 > dmg then
  1599.                 dmg = 300
  1600.             end
  1601.             if targchar == char and targhum == hum then
  1602.                 dmg = dmg/15
  1603.             end
  1604.             if obj == targhead then
  1605.                 targhum:TakeDamage(dmg)
  1606.             elseif not op then
  1607.                 targhum:TakeDamage(dmg)
  1608.             elseif op then
  1609.                 targhum.MaxHealth = 0
  1610.                 targhum.Health = 0
  1611.                 targhum.Parent:BreakJoints()
  1612.             end
  1613.             if math.random(1,2) == 1 then
  1614.                 break_limb(obj,targhum.RigType,targtorso,targhum)
  1615.             end
  1616.             add_blood(obj)
  1617.             local bleeding = Instance.new("Sound")
  1618.             bleeding.SoundId = 'rbxassetid://360007673'
  1619.             bleeding.Volume = 1
  1620.             bleeding.Parent = targtorso
  1621.             bleeding:Play()
  1622.             if 0 >= targhum.Health and obj == targhead then
  1623.                 kill(obj,true,p.CFrame.lookVector)
  1624.             elseif 0 >= targhum.Health then
  1625.                 kill(obj,false,p.CFrame.lookVector)
  1626.             elseif targhum.Health > 0 then
  1627.                 --bleed2(targtorso,targhum,true,5,false)
  1628.             end
  1629.     --[[
  1630.     else
  1631.         table.insert(objhit,1,obj)
  1632.         local mat = obj.Material
  1633.         local mathit = obj:FindFirstChild('material hit ' .. plr.Name)
  1634.         if not mathit and toughness > 0 and 1 > obj.Transparency then
  1635.             --print('old: ' .. toughness)
  1636.             if (mat == Enum.Material.Glass or mat == Enum.Material.Ice) then
  1637.                 breakwindow(obj)
  1638.             elseif (mat == Enum.Material.Wood or mat == Enum.Material.WoodPlanks) then
  1639.                 toughness = toughness - 1.5
  1640.             elseif (mat == Enum.Material.Metal or mat == Enum.Material.DiamondPlate or mat == Enum.Material.CorrodedMetal) then
  1641.                 toughness = toughness - 5
  1642.             elseif (mat == Enum.Material.Brick or mat == Enum.Material.Concrete or mat == Enum.Material.Cobblestone or mat == Enum.Material.Granite or mat == Enum.Material.Slate or mat == Enum.Material.Pebble) then
  1643.                 toughness = toughness - 3
  1644.             else
  1645.                 toughness = toughness - 1
  1646.             end
  1647.             --print('new: ' .. toughness)
  1648.             local libruary = {
  1649.                 ['wizz'] = {342190005, 342190012, 342190017, 342190024},
  1650.                 ['crackSmall'] = {873119768, 873119788, 873119811, 873119845, 873119886, 873119904},
  1651.                 ['crackBig'] = {873119597, 873119653, 873119679, 873119703, 873119724, 873119744},
  1652.                 ['whizz'] = {873121840, 873121858, 873121876, 873121896, 873121913, 873121936},
  1653.                 ['woodhit'] = {342204157, 342204164, 342204170, 342204175, 871705143, 871705174}, --871705195, 871705217, 871705237, 871705264
  1654.                 ['stonehit'] = {871701076, 871701134, 871701190, 871701241, 871701297, 871701346},
  1655.                 ['metalhit'] = {871704182, 871704259, 871704297, 871704329, 871704362, 871704395},
  1656.                 ['grasshit'] = {871709869, 871709832, 871709789, 871709755, 871709708, 871709643},
  1657.                 ['impact'] = {525720625},
  1658.             }
  1659.             local soundfont=({
  1660.                 Brick="stonehit";
  1661.                 Cobblestone="stonehit";
  1662.                 Concrete="stonehit";
  1663.                 CorrodedMetal="metalhit";
  1664.                 DiamondPlate="metalhit";
  1665.                 Fabric=nil;
  1666.                 Foil="metalhit";
  1667.                 Granite="stonehit";
  1668.                 Grass="grasshit";
  1669.                 Ice="stonehit";
  1670.                 Marble="stonehit";
  1671.                 Metal="metalhit";
  1672.                 Neon=nil;
  1673.                 Pebble="stonehit";
  1674.                 Plastic="metalhit";
  1675.                 Sand=nil;
  1676.                 Slate="stonehit";
  1677.                 SmoothPlastic="metalhit";
  1678.                 Wood="woodhit";
  1679.                 WoodPlanks="woodhit";
  1680.             })[mat.Name]
  1681.             local part = make_hole(CFrame.new(objpos, objpos - rot) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0)) * CFrame.Angles(math.rad(0), math.rad(math.random(-360, 360)), math.rad(0)), obj, obj.BrickColor)
  1682.             local BulletHoleSound = Instance.new("Sound")
  1683.             BulletHoleSound.Volume = 3
  1684.             BulletHoleSound.Pitch = math.random(9,11)/10
  1685.             local _id = ''
  1686.             if soundfont ~= nil then
  1687.                 BulletHoleSound.SoundId = "rbxassetid://"..libruary[soundfont][math.random(1,6)]
  1688.             else
  1689.                 BulletHoleSound.SoundId = "rbxassetid://"..libruary['impact'][1]
  1690.             end
  1691.             BulletHoleSound.Parent = part
  1692.             BulletHoleSound:Play()
  1693.             local tempmathit = Instance.new("ObjectValue")
  1694.             tempmathit.Name = ('material hit ' .. plr.Name)
  1695.             tempmathit.Parent = obj
  1696.             game:GetService("Debris"):AddItem(tempmathit,shootwait/bulletfire)
  1697.             game:GetService("Debris"):AddItem(part,7)
  1698.         end
  1699.     ]]
  1700.         end
  1701.     end
  1702.     --[[
  1703.     if toughness > 0 and rays > 0 then
  1704.         local found = false
  1705.         for i,v in pairs(oldobjhit) do if v and obj:IsDescendantOf(v) then found = true; end; end;
  1706.         oldobjhit = objhit
  1707.         if not plrhit and not found then
  1708.             rays = rays - 1
  1709.             wait()
  1710.         end
  1711.         local ig = {char,gun,script,unpack(objhit)}
  1712.         local _obj,_vec,_rot = raycast(objpos,(hitpos-han.Position).Unit, nil, ig)
  1713.         check(toughness,_obj,_vec,p,rays,_rot)
  1714.     else
  1715.         p:Destroy()
  1716.     end
  1717.     ]]
  1718. end
  1719.  
  1720. function drop_shell()
  1721.     local Shell = Instance.new("Part")
  1722.     Shell.Color = Color3.new(1, 1, 0)
  1723.     Shell.Size = Vector3.new(0.530001819, 0.132500455, 0.132500455)
  1724.     Shell.BottomSurface = Enum.SurfaceType.Smooth
  1725.     Shell.BrickColor = BrickColor.new("New Yeller")
  1726.     Shell.Material = Enum.Material.Metal
  1727.     Shell.Shape = Enum.PartType.Cylinder
  1728.     Shell.CFrame = han.CFrame
  1729.     Shell.Parent = script
  1730.     local bvs = Instance.new("BodyVelocity")
  1731.     bvs.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  1732.     bvs.Velocity = han.CFrame.lookVector+Vector3.new(0,10,-5)
  1733.     bvs.Parent = Shell
  1734.     game:GetService("Debris"):AddItem(bvs,0.1)
  1735.     game:GetService("Debris"):AddItem(Shell,10)
  1736. end
  1737.  
  1738. function Shoot()
  1739.     if not using and CheckIfAlive() and ammo > 0 then
  1740.         using = true
  1741.         wait()
  1742.         tween:Create(gun,TweenInfo.new(0.1),({Grip = CFrame.new(-0.704191327, 0.0157508347, -0.476390064, -4.22101856e-08, 0.259821802, -0.965656579, -0.99999994, 1.91068547e-15, 4.37113883e-08, 1.1357173e-08, 0.965656519, 0.259821832)})):Play()
  1743.         spawn(function()
  1744.             flash.Enabled = true
  1745.             light.Enabled = true
  1746.             smoke.Enabled = true
  1747.             wait()
  1748.             flash.Enabled = false
  1749.             light.Enabled = false
  1750.             smoke.Enabled = false
  1751.         end)
  1752.         spawn(function()
  1753.             for i = 1,bulletfire do
  1754.                 ammo = ammo - 1
  1755.                 --drop_shell()
  1756.                 --shoot_s.SoundId = 'rbxassetid://' .. sh[math.random(1,#shots)]
  1757.                 shoot_s:Play()
  1758.                 for i,v in ipairs(objhit) do table.remove(objhit,i); end;
  1759.                 for i,v in ipairs(objhit) do table.remove(oldobjhit,i); end;
  1760.                 spawn(function()
  1761.                     local p = Instance.new("Part")
  1762.                     p.Name = "bullet"
  1763.                     p.Massless = true
  1764.                     p.Anchored = false
  1765.                     p.CanCollide = false
  1766.                     p.Color = Color3.fromRGB(255, 255, 0)
  1767.                     p.Size = Vector3.new(0.5,0.5,1)
  1768.                     p.Transparency = 0
  1769.                     p.Position = han.Position
  1770.                     p.CFrame = CFrame.new(han.Position,hitpos)
  1771.                     p.Velocity = p.CFrame.lookVector * 2000
  1772.                     p.Material = Enum.Material.Neon
  1773.                     p.Parent = script
  1774.                     local mesh = Instance.new("SpecialMesh")
  1775.                     mesh.MeshType = Enum.MeshType.Sphere
  1776.                     mesh.Parent = p
  1777.                     --tween:Create(p,TweenInfo.new(((hitpos)-han.Position).Magnitude/10000),{Position = p.Position + ((hitpos)-han.Position).Unit*1000}):Play()
  1778.                     local body_vel = Instance.new("BodyVelocity")
  1779.                     body_vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  1780.                     body_vel.Velocity = p.CFrame.lookVector * 2000
  1781.                     body_vel.Parent = p
  1782.                     debris:AddItem(p,3)
  1783.                     game:GetService("TweenService"):Create(p,TweenInfo.new(3),{Size = Vector3.new(0.5,0.5,10),Transparency = 1}):Play()
  1784.                     fx_spot(hitpos)
  1785.                     local toughness = 6
  1786.                     local rays = 0
  1787.                     local ig = {char,gun,script}
  1788.                     local obj,vec,rot = raycast(han.Position,(hitpos-han.Position).Unit, nil, ig)
  1789.                     check(toughness,nil,vec,p,rays,nil) -- check(toughness,obj,vec,p,rays,rot)
  1790.                 end)
  1791.                 remote:FireClient(plr,1,shoot_s.SoundId,shoot_s,5,han)
  1792.                 wait(shootwait/bulletfire)
  1793.             end
  1794.         end)
  1795.         spawn(function()
  1796.             wait(0.1)
  1797.             tween:Create(gun,TweenInfo.new(0.1),({Grip = CFrame.new(-0.765321732, 0.0157508533, -0.438668579, -4.37113847e-08, -4.37113883e-08, -1, -0.99999994, 1.91068547e-15, 4.37113883e-08, 0, 0.99999994, -4.37113847e-08)})):Play()
  1798.         end)
  1799.         wait(shootwait)
  1800.         using = false
  1801.     end
  1802. end
  1803.  
  1804. gun.Activated:Connect(function()
  1805.     if not using and CheckIfAlive() and 0 >= ammo then
  1806.         Reload()
  1807.     end
  1808. end)
  1809.  
  1810. gun.Equipped:Connect(function()
  1811.     equipped = true
  1812.     pcall(function()
  1813.         char = gun.Parent
  1814.         plr = game:GetService("Players"):GetPlayerFromCharacter(char)
  1815.         hum = char:FindFirstChildOfClass("Humanoid")
  1816.         torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")
  1817.         rootpart = char:FindFirstChild("HumanoidRootPart")
  1818.         if not CheckIfAlive() then gun.Parent = nil return end
  1819.     end)
  1820. end)
  1821.  
  1822. gun.Unequipped:Connect(function()
  1823.     equipped = false
  1824. end)
  1825.  
  1826. remote = Instance.new("RemoteEvent")
  1827. remote.Name = 'mark1_remote'
  1828. remote.Parent = gun
  1829.  
  1830. remote.OnServerEvent:Connect(function(player,mode,data,data2)
  1831.     if equipped then else return end
  1832.     if plr == player and mode == 1 then
  1833.         if data ~= nil then
  1834.             hitpos = data
  1835.         end
  1836.         if data2 ~= nil then
  1837.             shooting = data2
  1838.         end
  1839.         if shooting then
  1840.             Shoot()
  1841.         end
  1842.     elseif not shooting and not using and CheckIfAlive() and plr == player and mode == 2 and data == 'reload' then
  1843.         Reload()
  1844.     end
  1845. end)
  1846.  
  1847. local ls = [[
  1848.     local plr = game:GetService("Players").LocalPlayer
  1849.     local mouse = plr:GetMouse()
  1850.     local char = plr.Character
  1851.     local remote = script.Parent
  1852.     local tool = remote.Parent
  1853.     local shooting = false
  1854.     local lh = Vector3.new()
  1855.     tool.Equipped:Connect(function()
  1856.         pcall(function()
  1857.             char = tool.Parent
  1858.         end)
  1859.         pcall(function()
  1860.             plr = game:GetService("Players"):GetPlayerFromCharacter(char)
  1861.         end)
  1862.         pcall(function()
  1863.             mouse = plr:GetMouse()
  1864.         end)
  1865.         if mouse then
  1866.             mouse.KeyDown:Connect(function(key)
  1867.                 if key == 'r' then
  1868.                     remote:FireServer(2,'reload')
  1869.                 end
  1870.             end)
  1871.             mouse.Button1Down:Connect(function()
  1872.                 local pos
  1873.                 if mouse.Hit then
  1874.                     pos = mouse.Hit.Position
  1875.                 end
  1876.                 lh = pos or Vector3.new()
  1877.                 remote:FireServer(1,pos,true)
  1878.                 wait(0.15)
  1879.                 remote:FireServer(1,lh,false)
  1880.             end)
  1881.         end
  1882.     end)
  1883.     remote.OnClientEvent:Connect(function(mode,data,inst,v,p)
  1884.         if mode == 1 then
  1885.             if inst then inst.Volume = 0; end;
  1886.             local sound = Instance.new("Sound")
  1887.             sound.SoundId = data
  1888.             sound.Volume = v
  1889.             sound.Parent = p
  1890.             sound:Play()
  1891.         elseif mode == 2 then
  1892.             --if inst then inst.Transparency = 1; end;
  1893.             local decal = Instance.new("Decal")
  1894.             decal.Texture = data
  1895.             decal.Transparency = v
  1896.             decal.Parent = p
  1897.             decal.Face = inst
  1898.         end
  1899.     end)
  1900. ]]
  1901.  
  1902. NLS(ls,remote)
Add Comment
Please, Sign In to add comment