KrYn0MoRe

Raygun Mark II

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