Advertisement
KrYn0MoRe

saber v1.5 (old combat system)

Jul 6th, 2018
822
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.94 KB | None | 0 0
  1. local plr = owner
  2. local char = plr.Character
  3. local torso = char:FindFirstChild("Torso")
  4. local rootpart = char:FindFirstChild("HumanoidRootPart")
  5. local hum = char:FindFirstChildOfClass("Humanoid")
  6.  
  7. local colors = {Color3.fromRGB(0,170,255),Color3.fromRGB(170,0,0),Color3.fromRGB(0,170,0)}
  8. local color = colors[math.random(1,#colors)]
  9.  
  10. if hum.RigType ~= Enum.HumanoidRigType.R6 then warn("Character must be in R6 to use this script.") return end
  11.  
  12. local tool = Instance.new("Tool")
  13. local ParticleEmitter3 = Instance.new("ParticleEmitter")
  14. local ParticleEmitter4 = Instance.new("ParticleEmitter")
  15. local ParticleEmitter5 = Instance.new("ParticleEmitter")
  16. local ParticleEmitter6 = Instance.new("ParticleEmitter")
  17. local ParticleEmitter7 = Instance.new("ParticleEmitter")
  18. local ParticleEmitter8 = Instance.new("ParticleEmitter")
  19. local ParticleEmitter9 = Instance.new("ParticleEmitter")
  20. local ParticleEmitter10 = Instance.new("ParticleEmitter")
  21. tool.Name = "Lightsaber"
  22. tool.Parent = plr['Backpack']
  23. tool.Grip = CFrame.new(2.29999948, 0.0200000294, 0.029999923, -4.37113883e-08, -1, 0, 1, -4.37113883e-08, 0, 0, 0, 1)
  24. tool.ToolTip = "Jedi master."
  25. Part1 = Instance.new("Part")
  26. Part2 = Instance.new("Part")
  27. handle = Instance.new("Part")
  28. Part4 = Instance.new("Part")
  29. Part5 = Instance.new("Part")
  30. Part6 = Instance.new("Part")
  31. Part7 = Instance.new("Part")
  32. Part8 = Instance.new("Part")
  33. Part9 = Instance.new("Part")
  34. Part1.Parent = tool
  35. Part1.CFrame = CFrame.new(-18.8149967, 1.28000009, 5.46999979, 0, 0, 1, -1, 0, 0, 0, -1, 0)
  36. Part1.Orientation = Vector3.new(0, 90, -90)
  37. Part1.Position = Vector3.new(-18.8149967, 1.28000009, 5.46999979)
  38. Part1.Rotation = Vector3.new(-90, 90, 0)
  39. Part1.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  40. Part1.Size = Vector3.new(1.77999997, 0.400000006, 0.400000006)
  41. Part1.BottomSurface = Enum.SurfaceType.Smooth
  42. Part1.BrickColor = BrickColor.new("Really black")
  43. Part1.CanCollide = false
  44. Part1.Locked = true
  45. Part1.Material = Enum.Material.SmoothPlastic
  46. Part1.TopSurface = Enum.SurfaceType.Smooth
  47. Part1.brickColor = BrickColor.new("Really black")
  48. Part1.Shape = Enum.PartType.Cylinder
  49. Part2.Parent = tool
  50. Part2.CFrame = CFrame.new(-18.8050003, 2.10899997, 5.47700024, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  51. Part2.Position = Vector3.new(-18.8050003, 2.10899997, 5.47700024)
  52. Part2.Transparency = 1
  53. Part2.Size = Vector3.new(0.0500000007, 0.200000003, 0.0500000007)
  54. Part2.BottomSurface = Enum.SurfaceType.Smooth
  55. Part2.CanCollide = false
  56. Part2.Locked = true
  57. Part2.TopSurface = Enum.SurfaceType.Smooth
  58. handle.Name = "Handle"
  59. handle.Parent = tool
  60. handle.CFrame = CFrame.new(-18.8049946, 3.49000025, 5.46999788, 0, 0, 1, -1, 0, 0, 0, -1, 0)
  61. handle.Orientation = Vector3.new(0, 90, -90)
  62. handle.Position = Vector3.new(-18.8049946, 3.49000025, 5.46999788)
  63. handle.Rotation = Vector3.new(-90, 90, 0)
  64. handle.Transparency = 1
  65. handle.Size = Vector3.new(6.19999981, 0.699999988, 0.699999988)
  66. handle.BottomSurface = Enum.SurfaceType.Smooth
  67. handle.CanCollide = false
  68. handle.Locked = true
  69. handle.TopSurface = Enum.SurfaceType.Smooth
  70. handle.Shape = Enum.PartType.Cylinder
  71. Part4.Name = "color"
  72. Part4.Parent = tool
  73. Part4.CFrame = CFrame.new(-18.9649982, 1.69999957, 5.46999979, -1, 0, 0, 0, 0, -1, 0, -1, 0)
  74. Part4.Orientation = Vector3.new(90, 180, 0)
  75. Part4.Position = Vector3.new(-18.9649982, 1.69999957, 5.46999979)
  76. Part4.Rotation = Vector3.new(90, 0, -180)
  77. Part4.Color = Color3.new(0.972549, 0.972549, 0.972549)
  78. Part4.Size = Vector3.new(0.180000708, 0.214615837, 0.214615837)
  79. Part4.BottomSurface = Enum.SurfaceType.Smooth
  80. Part4.BrickColor = BrickColor.new("Institutional white")
  81. Part4.CanCollide = false
  82. Part4.Locked = true
  83. Part4.Material = Enum.Material.Neon
  84. Part4.TopSurface = Enum.SurfaceType.Smooth
  85. Part4.brickColor = BrickColor.new("Institutional white")
  86. Part4.Shape = Enum.PartType.Cylinder
  87. Part5.Parent = tool
  88. Part5.CFrame = CFrame.new(-18.8149967, 2.1950016, 5.46999979, 0, 0, 1, -1, 0, 0, 0, -1, 0)
  89. Part5.Orientation = Vector3.new(0, 90, -90)
  90. Part5.Position = Vector3.new(-18.8149967, 2.1950016, 5.46999979)
  91. Part5.Rotation = Vector3.new(-90, 90, 0)
  92. Part5.Color = Color3.new(0.972549, 0.972549, 0.972549)
  93. Part5.Size = Vector3.new(0.109999999, 0.300000012, 0.300000012)
  94. Part5.BottomSurface = Enum.SurfaceType.Smooth
  95. Part5.BrickColor = BrickColor.new("Institutional white")
  96. Part5.CanCollide = false
  97. Part5.Locked = true
  98. Part5.Material = Enum.Material.Neon
  99. Part5.TopSurface = Enum.SurfaceType.Smooth
  100. Part5.brickColor = BrickColor.new("Institutional white")
  101. Part5.Shape = Enum.PartType.Cylinder
  102. Part6.Name = "color"
  103. Part6.Parent = tool
  104. Part6.CFrame = CFrame.new(-18.8149967, 1.96500063, 5.46999979, 0, 0, 1, -1, 0, 0, 0, -1, 0)
  105. Part6.Orientation = Vector3.new(0, 90, -90)
  106. Part6.Position = Vector3.new(-18.8149967, 1.96500063, 5.46999979)
  107. Part6.Rotation = Vector3.new(-90, 90, 0)
  108. Part6.Color = Color3.new(0.972549, 0.972549, 0.972549)
  109. Part6.Size = Vector3.new(0.230000004, 0.230000004, 0.230000004)
  110. Part6.BottomSurface = Enum.SurfaceType.Smooth
  111. Part6.BrickColor = BrickColor.new("Institutional white")
  112. Part6.CanCollide = false
  113. Part6.Locked = true
  114. Part6.Material = Enum.Material.Neon
  115. Part6.TopSurface = Enum.SurfaceType.Smooth
  116. Part6.brickColor = BrickColor.new("Institutional white")
  117. Part6.Shape = Enum.PartType.Ball
  118. Part7.Name = "color"
  119. Part7.Parent = tool
  120. Part7.CFrame = CFrame.new(-18.8149967, 0.46500203, 5.46999979, 0, 0, 1, -1, 0, 0, 0, -1, 0)
  121. Part7.Orientation = Vector3.new(0, 90, -90)
  122. Part7.Position = Vector3.new(-18.8149967, 0.46500203, 5.46999979)
  123. Part7.Rotation = Vector3.new(-90, 90, 0)
  124. Part7.Color = Color3.new(0.972549, 0.972549, 0.972549)
  125. Part7.Size = Vector3.new(0.0500000007, 0.419999987, 0.419999987)
  126. Part7.BottomSurface = Enum.SurfaceType.Smooth
  127. Part7.BrickColor = BrickColor.new("Institutional white")
  128. Part7.CanCollide = false
  129. Part7.Locked = true
  130. Part7.Material = Enum.Material.Neon
  131. Part7.TopSurface = Enum.SurfaceType.Smooth
  132. Part7.brickColor = BrickColor.new("Institutional white")
  133. Part7.Shape = Enum.PartType.Cylinder
  134. Part8.Name = "color"
  135. Part8.Parent = tool
  136. Part8.CFrame = CFrame.new(-18.8150005, 0.86500001, 5.46999979, 0, 0, 1, -1, 0, 0, 0, -1, 0)
  137. Part8.Orientation = Vector3.new(0, 90, -90)
  138. Part8.Position = Vector3.new(-18.8150005, 0.86500001, 5.46999979)
  139. Part8.Rotation = Vector3.new(-90, 90, 0)
  140. Part8.Color = Color3.new(0.972549, 0.972549, 0.972549)
  141. Part8.Size = Vector3.new(0.0500000007, 0.419999987, 0.419999987)
  142. Part8.BottomSurface = Enum.SurfaceType.Smooth
  143. Part8.BrickColor = BrickColor.new("Institutional white")
  144. Part8.CanCollide = false
  145. Part8.Locked = true
  146. Part8.Material = Enum.Material.Neon
  147. Part8.TopSurface = Enum.SurfaceType.Smooth
  148. Part8.brickColor = BrickColor.new("Institutional white")
  149. Part8.Shape = Enum.PartType.Cylinder
  150. Part9.Name = "color"
  151. Part9.Parent = tool
  152. Part9.CFrame = CFrame.new(-18.8150005, 0.665000021, 5.46999979, 0, 0, 1, -1, 0, 0, 0, -1, 0)
  153. Part9.Orientation = Vector3.new(0, 90, -90)
  154. Part9.Position = Vector3.new(-18.8150005, 0.665000021, 5.46999979)
  155. Part9.Rotation = Vector3.new(-90, 90, 0)
  156. Part9.Color = Color3.new(0.972549, 0.972549, 0.972549)
  157. Part9.Size = Vector3.new(0.0500000007, 0.419999987, 0.419999987)
  158. Part9.BottomSurface = Enum.SurfaceType.Smooth
  159. Part9.BrickColor = BrickColor.new("Institutional white")
  160. Part9.CanCollide = false
  161. Part9.Locked = true
  162. Part9.Material = Enum.Material.Neon
  163. Part9.TopSurface = Enum.SurfaceType.Smooth
  164. Part9.brickColor = BrickColor.new("Institutional white")
  165. Part9.Shape = Enum.PartType.Cylinder
  166. ParticleEmitter3.Name = "Inner"
  167. ParticleEmitter3.Speed = NumberRange.new(4.5, 4.5)
  168. ParticleEmitter3.Color = ColorSequence.new(Color3.new(1,1,1),Color3.new(1,1,1))
  169. ParticleEmitter3.LightEmission = 0.5
  170. ParticleEmitter3.LightInfluence = 0
  171. ParticleEmitter3.Texture = "rbxassetid://172380355"
  172. ParticleEmitter3.Transparency = NumberSequence.new(0.7,0.7)
  173. ParticleEmitter3.ZOffset = -1
  174. ParticleEmitter3.Size = NumberSequence.new(0.09,0.09)
  175. ParticleEmitter3.Lifetime = NumberRange.new(1, 1)
  176. ParticleEmitter3.LockedToPart = true
  177. ParticleEmitter3.Rate = 10000
  178. ParticleEmitter7.Name = "Outer"
  179. ParticleEmitter7.Parent = Part2
  180. ParticleEmitter7.Speed = NumberRange.new(4.5, 4.5)
  181. ParticleEmitter7.Color = ColorSequence.new(color,color)
  182. ParticleEmitter7.LightEmission = 0.5
  183. ParticleEmitter7.LightInfluence = 0
  184. ParticleEmitter7.Texture = "rbxassetid://172380355"
  185. ParticleEmitter7.Transparency = NumberSequence.new(0.95,0.95)
  186. ParticleEmitter7.ZOffset = -1.1
  187. ParticleEmitter7.Size = NumberSequence.new(0.33,0.33)
  188. ParticleEmitter7.Lifetime = NumberRange.new(1, 1)
  189. ParticleEmitter7.LockedToPart = true
  190. ParticleEmitter7.Rate = 10000
  191. ParticleEmitter4 = ParticleEmitter3:Clone()
  192. ParticleEmitter5 = ParticleEmitter3:Clone()
  193. ParticleEmitter6 = ParticleEmitter3:Clone()
  194. ParticleEmitter8 = ParticleEmitter7:Clone()
  195. ParticleEmitter9 = ParticleEmitter7:Clone()
  196. ParticleEmitter10 = ParticleEmitter7:Clone()
  197. ParticleEmitter3.Parent = Part2
  198. ParticleEmitter4.Parent = Part2
  199. ParticleEmitter5.Parent = Part2
  200. ParticleEmitter6.Parent = Part2
  201. ParticleEmitter7.Parent = Part2
  202. ParticleEmitter8.Parent = Part2
  203. ParticleEmitter9.Parent = Part2
  204. ParticleEmitter10.Parent = Part2
  205. local spark = Instance.new("ParticleEmitter")
  206. spark.Enabled = false
  207. spark.Name = "spark"
  208. spark.Parent = handle
  209. spark.Speed = NumberRange.new(0.20000000298023, 0.20000000298023)
  210. spark.Rotation = NumberRange.new(45, 45)
  211. spark.Color = ColorSequence.new(Color3.new(1, 0.784314, 0), Color3.new(1, 1, 0.203922))
  212. spark.LightEmission = 3
  213. spark.Texture = "rbxassetid://134531274"
  214. spark.ZOffset = 2
  215. spark.Size = NumberSequence.new(0.24999976158142,0)
  216. spark.Lifetime = NumberRange.new(1, 2)
  217. spark.Rate = 400
  218. spark.Speed = NumberRange.new(0.5, 1)
  219. spark.RotSpeed = NumberRange.new(20, 20)
  220. spark.SpreadAngle = Vector2.new(180, 180)
  221. spark.VelocitySpread = 180
  222. local att = Instance.new("Attachment")
  223. att.Parent = handle
  224. att.Position = Vector3.new(handle.Size.X/(math.random(40,70)/100),0,0)
  225. local shock = Instance.new("ParticleEmitter")
  226. shock.Parent = att
  227. shock.Speed = NumberRange.new(1, 1)
  228. shock.Rotation = NumberRange.new(-180, 180)
  229. shock.Color = ColorSequence.new({
  230. ColorSequenceKeypoint.new(0, Color3.new(1, 1, 0)),
  231. ColorSequenceKeypoint.new(0.155, Color3.new(1, 0.721201, 0.0644535)),
  232. ColorSequenceKeypoint.new(0.166, Color3.new(1, 0.956581, 0.0100378)),
  233. ColorSequenceKeypoint.new(0.186, Color3.new(1, 0.72522, 0.0635244)),
  234. ColorSequenceKeypoint.new(0.196, Color3.new(1, 0.757413, 0.0560818)),
  235. ColorSequenceKeypoint.new(0.587, Color3.new(1, 0.690516, 0.0715474)),
  236. ColorSequenceKeypoint.new(0.737, Color3.new(1, 0.969307, 0.907922)),
  237. ColorSequenceKeypoint.new(1, Color3.new(1, 1, 1)),
  238. })
  239. shock.Enabled = false
  240. shock.LightEmission = 1
  241. shock.LightInfluence = 0
  242. shock.Texture = "rbxassetid://1084955012"
  243. shock.Transparency = NumberSequence.new({
  244. NumberSequenceKeypoint.new(0,0.88311409950256),
  245. NumberSequenceKeypoint.new(0.0555,0.98257392644882),
  246. NumberSequenceKeypoint.new(0.111,0.17053742706776),
  247. NumberSequenceKeypoint.new(0.167,0.39307841658592),
  248. NumberSequenceKeypoint.new(0.222,0.12906277179718),
  249. NumberSequenceKeypoint.new(0.278,0.92074340581894),
  250. NumberSequenceKeypoint.new(0.333,0.41569262742996),
  251. NumberSequenceKeypoint.new(0.389,0.21503341197968),
  252. NumberSequenceKeypoint.new(0.444,0.78206729888916),
  253. NumberSequenceKeypoint.new(0.5,0.23203222453594),
  254. NumberSequenceKeypoint.new(0.555,0.78981900215149),
  255. NumberSequenceKeypoint.new(0.61,0.81099885702133),
  256. NumberSequenceKeypoint.new(0.666,0.91161841154099),
  257. NumberSequenceKeypoint.new(0.721,0.87456893920898),
  258. NumberSequenceKeypoint.new(0.777,0.41929379105568),
  259. NumberSequenceKeypoint.new(0.832,0.30027160048485),
  260. NumberSequenceKeypoint.new(0.888,0.16400647163391),
  261. NumberSequenceKeypoint.new(0.943,0.39603871107101),
  262. NumberSequenceKeypoint.new(0.999,0.70033878087997),
  263. NumberSequenceKeypoint.new(1,1)
  264. })
  265. shock.ZOffset = 0
  266. shock.Size = NumberSequence.new(0,4.875)
  267. shock.Lifetime = NumberRange.new(0.5, 0.5)
  268. shock.Rate = 10
  269. shock.RotSpeed = NumberRange.new(-100, 100)
  270. local glow = Instance.new("ParticleEmitter")
  271. glow.Parent = att
  272. glow.Speed = NumberRange.new(1, 1)
  273. glow.Rotation = NumberRange.new(-180, 180)
  274. glow.Color = ColorSequence.new({
  275. ColorSequenceKeypoint.new(0, Color3.new(1, 0.666667, 0)),
  276. ColorSequenceKeypoint.new(0.614, Color3.new(1, 0.69218, 0)),
  277. ColorSequenceKeypoint.new(0.882, Color3.new(1, 0.961668, 0)),
  278. ColorSequenceKeypoint.new(1, Color3.new(1, 1, 0)),
  279. })
  280. glow.Enabled = false
  281. glow.LightEmission = 0.5
  282. glow.LightInfluence = 0
  283. glow.Texture = "rbxassetid://867619398"
  284. glow.Transparency = NumberSequence.new(0,1)
  285. glow.ZOffset = -1
  286. glow.Size = NumberSequence.new(0,5)
  287. glow.Lifetime = NumberRange.new(0.5, 0.5)
  288. glow.Rate = 10
  289. glow.RotSpeed = NumberRange.new(-100, 100)
  290. glow.SpreadAngle = Vector2.new(100, 100)
  291. glow.VelocitySpread = 100
  292. local light = Instance.new("PointLight")
  293. light.Color = color
  294. light.Range = 5
  295. light.Brightness = 25
  296. light.Shadows = true
  297. light.Enabled = true
  298. light.Parent = handle
  299. local selection = Instance.new("SelectionBox")
  300. selection.Parent = handle
  301. selection.Visible = false
  302. selection.Color = BrickColor.new("New Yeller")
  303. selection.Color3 = Color3.new(1, 1, 0.109804)
  304. selection.Adornee = handle
  305. selection.LineThickness = 0.050000000745058
  306.  
  307. for _,obj in pairs(tool:GetChildren()) do
  308.     if obj:IsA("Part") then
  309.         pcall(function()
  310.             local weld = Instance.new("Weld")
  311.             weld.Part0 = handle
  312.             weld.Part1 = obj
  313.             weld.C0 = handle.CFrame:Inverse()
  314.             weld.C1 = obj.CFrame:Inverse()
  315.             weld.Parent = tool
  316.         end)
  317.     end
  318.     if obj:IsA("Part") and obj.Name == "color" then
  319.         obj.Color = color
  320.     end
  321. end
  322.  
  323. local at1,at2,Trail = Instance.new("Attachment"),Instance.new("Attachment"),Instance.new("Trail")
  324. at1.Parent,at2.Parent,Trail.Parent = handle,handle,handle
  325. at1.Position = Vector3.new(-3.1, 0, 0)
  326. at2.Position = Vector3.new(3.1, 0, 0)
  327. Trail.Enabled = false
  328. Trail.Attachment0 = at1
  329. Trail.Attachment1 = at2
  330. Trail.Color = ColorSequence.new(color,color)
  331. Trail.Transparency = NumberSequence.new(0,1)
  332. Trail.Lifetime = NumberSequence.new(0.5,0.5)
  333.  
  334. local swings = {4374879236,4374878756,4374877983} -- 4374878364
  335.  
  336. local swingsound = Instance.new("Sound")
  337. swingsound.SoundId = 'rbxassetid://' .. swings[math.random(1,#swings)]
  338. swingsound.Volume = 1
  339. swingsound.Parent = handle
  340.  
  341. local hitsound = Instance.new("Sound")
  342. hitsound.SoundId = 'rbxassetid://1335649595'
  343. hitsound.Volume = 1
  344. hitsound.Parent = handle
  345.  
  346. local humsound = Instance.new("Sound")
  347. humsound.SoundId = 'rbxassetid://605578076'
  348. humsound.Volume = 0.5
  349. humsound.Looped = true
  350. humsound.Parent = handle
  351.  
  352. local onsound = Instance.new("Sound")
  353. onsound.SoundId = 'rbxassetid://605604103'
  354. onsound.Volume = 1
  355. onsound.Parent = handle
  356.  
  357. local offsound = Instance.new("Sound")
  358. offsound.SoundId = 'rbxassetid://605607641'
  359. offsound.Volume = 1
  360. offsound.Parent = handle
  361.  
  362. local damage = math.random(20,25)
  363. local animval = 1
  364. local counter = 0
  365. local cooldown = 0
  366. local resetcooldown = 0.1
  367. local attacking = false
  368. local damaging = false
  369. local equipping = false
  370.  
  371. local anims = {33169596,204062532,218504594}
  372.  
  373. local animation = Instance.new("Animation")
  374. animation.AnimationId = "rbxassetid://" .. anims[math.random(1,#anims)]
  375.  
  376. local swinganim = hum:LoadAnimation(animation)
  377.  
  378. local equipanimation = Instance.new("Animation")
  379. equipanimation.AnimationId = "rbxassetid://86504773"
  380.  
  381. local equipanim = hum:LoadAnimation(equipanimation)
  382.  
  383. local idleanimation = Instance.new("Animation")
  384. idleanimation.AnimationId = "rbxassetid://94108418"
  385.  
  386. local idleanim = hum:LoadAnimation(idleanimation)
  387.  
  388. local Connection,CurrentHealth
  389. local screen,healthbar,healthstat,staminabar,staminastat,blockbar,blockstat
  390. local stamina,staminamax = 100,100
  391. local blockhealth,blockhealthmax = 100,100
  392. local stamina_counter,block_counter = 0,0
  393.  
  394. function limb_collide(obj,mode)
  395.     if (obj:IsA("UnionOperation") or obj:IsA("BasePart")) then else return end
  396.     local exists = pcall(game:GetService("PhysicsService").GetCollisionGroupId, game:GetService("PhysicsService"), 'Limb Collide')
  397.     if not exists then
  398.         game:GetService("PhysicsService"):CreateCollisionGroup('Limb Collide')
  399.     end
  400.     game:GetService("PhysicsService"):CollisionGroupSetCollidable('Limb Collide','Limb Collide',false)
  401.     --
  402.     local t = {}
  403.     --
  404.     local cb = Instance.new("Part")
  405.     cb.Name = 'limb'
  406.     cb.Transparency = 1
  407.     cb.CanCollide = true
  408.     cb.Anchored = false
  409.     cb.CFrame = obj.CFrame
  410.     cb.Size = obj.Size
  411.     cb.Massless = true
  412.     cb.Locked = true
  413.     game:GetService("PhysicsService"):SetPartCollisionGroup(cb,'Limb Collide')
  414.     game:GetService("PhysicsService"):SetPartCollisionGroup(obj,'Limb Collide')
  415.     local weld = Instance.new("Weld")
  416.     weld.Part0 = cb
  417.     weld.Part1 = obj
  418.     weld.Parent = cb
  419.     obj.Massless = true
  420.     obj.Anchored = false
  421.     if mode then
  422.         cb.Parent = obj.Parent
  423.     else
  424.         cb.Parent = script
  425.     end
  426.     table.insert(t,1,cb)
  427.     --
  428.     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
  429.         local lv = Vector3.new() -- Vector3.new(cb.Size.X,0,cb.Size.Z)
  430.         local cb2 = Instance.new("Part")
  431.         cb2.Name = 'limb'
  432.         cb2.Transparency = 1
  433.         cb2.CanCollide = true
  434.         cb2.Anchored = false
  435.         cb2.CFrame = obj.CFrame
  436.         cb2.Size = lv
  437.         cb2.Massless = true
  438.         cb2.Locked = true
  439.         local weld2 = Instance.new("Weld")
  440.         weld2.Part0 = cb
  441.         weld2.Part1 = cb2
  442.         weld2.C1 = CFrame.new(0,(cb.Size.Y/2),0)
  443.         weld2.Parent = cb2
  444.         if mode then
  445.             cb2.Parent = obj.Parent
  446.         else
  447.             cb2.Parent = script
  448.         end
  449.         table.insert(t,1,cb2)
  450.     end
  451.     --
  452.     return t
  453. end
  454.  
  455. function Ragdoll(targchar,headless,insta,kill)
  456.     local pc = targchar
  457.     local targhum = pc:FindFirstChild("Humanoid")
  458.     local js,js2 = {},{}
  459.     for _,obj in pairs(pc:GetDescendants()) do
  460.         if obj:IsA("BasePart") or obj:IsA("UnionOperation") then
  461.             obj.Massless = true
  462.             obj.Locked = true
  463.         end
  464.     end
  465.     if kill == true then
  466.         pc.Archivable = true
  467.         local old_pc = pc
  468.         pc = pc:Clone()
  469.         for i,v in pairs(pc:GetDescendants()) do
  470.             limb_collide(v,true)
  471.             if v:IsA("ParticleEmitter") then
  472.                 v.Enabled = false
  473.             end
  474.             if 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
  475.                 v:Destroy()
  476.             end
  477.             if (v:IsA("Script") and v.Name == 'Health') or (v:IsA("LocalScript") and v.Name == 'Animate') then
  478.                 v:Destroy()
  479.             end
  480.             if v:IsA("Humanoid") then
  481.                 v.BreakJointsOnDeath = false
  482.                 v.Health = 0
  483.                 v.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
  484.                 v.PlatformStand = true
  485.             end
  486.         end
  487.         for i,v in pairs(old_pc:GetDescendants()) do
  488.             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
  489.                 v:destroy()
  490.             end
  491.             if v:IsA("Humanoid") then
  492.                 v.BreakJointsOnDeath = true
  493.                 v.Health = 0
  494.                 v.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
  495.                 v.PlatformStand = true
  496.             end
  497.         end
  498.         pc.Parent = workspace
  499.     end
  500.     --if kill and targhum:FindFirstChild("Ragdolled") then return; end;
  501.     if pc ~= nil then
  502.         local hum = pc:FindFirstChild'Humanoid'
  503.         local LArm = pc:FindFirstChild'Left Arm'
  504.         local RArm = pc:FindFirstChild'Right Arm'
  505.         local LLeg = pc:FindFirstChild'Left Leg'
  506.         local RLeg = pc:FindFirstChild'Right Leg'
  507.         local torso = pc:FindFirstChild'Torso'
  508.         local head = pc:FindFirstChild'Head'
  509.        
  510.        
  511.         local LUA = pc:FindFirstChild'LeftUpperArm'
  512.         local LLA = pc:FindFirstChild'LeftLowerArm'
  513.         local LH = pc:FindFirstChild'LeftHand'
  514.        
  515.         local RUA = pc:FindFirstChild'RightUpperArm'
  516.         local RLA = pc:FindFirstChild'RightLowerArm'
  517.         local RH = pc:FindFirstChild'RightHand'
  518.        
  519.         local LUL = pc:FindFirstChild'LeftUpperLeg'
  520.         local LLL = pc:FindFirstChild'LeftLowerLeg'
  521.         local LF = pc:FindFirstChild'LeftFoot'
  522.        
  523.         local RUL = pc:FindFirstChild'RightUpperLeg'
  524.         local RLL = pc:FindFirstChild'RightLowerLeg'
  525.         local RF = pc:FindFirstChild'RightFoot'
  526.        
  527.         local UT = pc:FindFirstChild'UpperTorso'
  528.         local LT = pc:FindFirstChild'LowerTorso'
  529.        
  530.         if hum and LArm and RArm and LLeg and RLeg and head then
  531.             hum.BreakJointsOnDeath = false
  532.             if insta then
  533.                 if hum.RigType==Enum.HumanoidRigType.R6 then
  534.                     for _,v in pairs(torso:GetDescendants()) do
  535.                         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
  536.                             if not kill then
  537.                                 table.insert(js2,1,{obj = v,par = v.Parent})
  538.                                 v.Parent = nil
  539.                             elseif kill then
  540.                                 v:Destroy()
  541.                             end
  542.                         end
  543.                     end
  544.                    local vis = false
  545.                    local vis2 = false
  546.                     if not LArm:FindFirstChild('Dismembered') then
  547.                        local at1 = Instance.new("Attachment")
  548.                        at1.Parent = torso
  549.                        at1.Visible = vis
  550.                        at1.Orientation = torso.Orientation + Vector3.new(0,180,0)
  551.                        at1.Position = Vector3.new(-1,1,0)
  552.                                        
  553.                        local at1p2 = Instance.new("Attachment")
  554.                        at1p2.Parent = LArm
  555.                        at1p2.Visible = vis
  556.                        at1p2.Orientation = LArm.Orientation + Vector3.new(0,180,0)
  557.                        at1p2.Position = Vector3.new(.5,1,0)
  558.                            
  559.                        local bis = Instance.new("BallSocketConstraint")
  560.                        bis.Parent = LArm
  561.                        bis.Attachment0 = at1
  562.                        bis.Attachment1 = at1p2
  563.                        bis.LimitsEnabled = true
  564.                        bis.UpperAngle = 15
  565.                        bis.Visible = vis2
  566.                        bis.TwistLimitsEnabled = true
  567.                        bis.UpperAngle = -45
  568.                        bis.TwistLowerAngle = -45
  569.                         table.insert(js,1,bis)
  570.                     end
  571.                     if not RArm:FindFirstChild('Dismembered') then    
  572.                         local at2 = Instance.new("Attachment")
  573.                         at2.Parent = torso
  574.                         at2.Visible = vis
  575.                         at2.Orientation = torso.Orientation + Vector3.new(0,0,0)
  576.                         at2.Position = Vector3.new(1,1,0)
  577.                                
  578.                         local at2p2 = Instance.new("Attachment")
  579.                         at2p2.Parent = RArm
  580.                         at2p2.Visible = vis
  581.                         at2p2.Orientation = RArm.Orientation + Vector3.new(0,0,0)
  582.                         at2p2.Position = Vector3.new(-.5,1,0)
  583.                        
  584.                         local bis2 = Instance.new("BallSocketConstraint")
  585.                         bis2.Parent = RArm
  586.                         bis2.Attachment0 = at2
  587.                         bis2.Attachment1 = at2p2
  588.                         bis2.LimitsEnabled = true
  589.                         bis2.UpperAngle = 15
  590.                         bis2.Visible = vis2
  591.                         bis2.TwistLimitsEnabled = true
  592.                         bis2.UpperAngle = -45
  593.                         bis2.TwistLowerAngle = -45
  594.                         table.insert(js,1,bis2)
  595.                     end
  596.                      if not RLeg:FindFirstChild('Dismembered') then
  597.                         local at3 = Instance.new("Attachment")
  598.                         at3.Parent = torso
  599.                         at3.Visible = vis
  600.                         at3.Orientation = torso.Orientation + Vector3.new(90,0,-90)
  601.                         at3.Position = Vector3.new(.5,-1,0)
  602.                                
  603.                         local at3p2 = Instance.new("Attachment")
  604.                         at3p2.Parent = RLeg
  605.                         at3p2.Visible = vis
  606.                         at3p2.Orientation = RLeg.Orientation + Vector3.new(90,0,-90)
  607.                         at3p2.Position = Vector3.new(0,1,0)
  608.                        
  609.                         local bis3 = Instance.new("BallSocketConstraint")
  610.                         bis3.Parent = RLeg
  611.                         bis3.Attachment0 = at3
  612.                         bis3.Attachment1 = at3p2
  613.                         bis3.LimitsEnabled = true
  614.                         bis3.UpperAngle = 180-15
  615.                         bis3.Visible = vis2
  616.                         table.insert(js,1,bis3)
  617.                     end
  618.                          
  619.                     if not LLeg:FindFirstChild('Dismembered') then  
  620.                         local at4 = Instance.new("Attachment")
  621.                         at4.Parent = torso
  622.                         at4.Visible = vis
  623.                         at4.Orientation = torso.Orientation + Vector3.new(90,0,-90)
  624.                         at4.Position = Vector3.new(-.5,-1,0)
  625.                                
  626.                         local at4p2 = Instance.new("Attachment")
  627.                         at4p2.Parent = LLeg
  628.                         at4p2.Visible = vis
  629.                         at4p2.Orientation = LLeg.Orientation + Vector3.new(90,0,-90)
  630.                         at4p2.Position = Vector3.new(0,1,0)
  631.                    
  632.                         local bis4 = Instance.new("BallSocketConstraint")
  633.                         bis4.Parent = LLeg
  634.                         bis4.Attachment0 = at4
  635.                         bis4.Attachment1 = at4p2
  636.                         bis4.LimitsEnabled = true
  637.                         bis4.UpperAngle = 180-15
  638.                         bis4.Visible = vis2
  639.                         table.insert(js,1,bis4)
  640.                     end
  641.                    
  642.                     if not headless and not head:FindFirstChild('Dismembered') then  
  643.                             local at5 = Instance.new("Attachment")
  644.                             at5.Parent = torso
  645.                             at5.Visible = vis
  646.                             at5.Orientation = torso.Orientation + Vector3.new(180,90,0)
  647.                             at5.Position = Vector3.new(0,1,0)
  648.                          
  649.                             local at5p2 = Instance.new("Attachment")
  650.                             at5p2.Parent = head
  651.                             at5p2.Visible = vis
  652.                             at5p2.Orientation = head.Orientation + Vector3.new(180,90,0)
  653.                             at5p2.Position = Vector3.new(0,-.5,0)
  654.                    
  655.                             local bis5 = Instance.new("BallSocketConstraint")
  656.                             bis5.Parent = head
  657.                             bis5.Attachment0 = at5p2
  658.                             bis5.Attachment1 = at5
  659.                             bis5.LimitsEnabled = true
  660.                             bis5.UpperAngle = 75
  661.                             bis5.Visible = vis2
  662.                             bis5.TwistLimitsEnabled = true
  663.                             bis5.UpperAngle = -45
  664.                             bis5.TwistLowerAngle = -45
  665.                             table.insert(js,1,bis5)
  666.                         else
  667.                             --head:BreakJoints()
  668.                         end
  669.                     end
  670.             else
  671.                 hum.Died:Connect(function()
  672.                 if hum.RigType==Enum.HumanoidRigType.R6 then
  673.                     for _,v in pairs(torso:GetDescendants()) do
  674.                         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
  675.                             if not kill then
  676.                                 table.insert(js2,1,{obj = v,par = v.Parent})
  677.                                 v.Parent = nil
  678.                             elseif kill then
  679.                                 v:Destroy()
  680.                             end
  681.                         end
  682.                     end
  683.                    local vis = false
  684.                    local vis2 = false
  685.                     if not LArm:FindFirstChild('Dismembered') then
  686.                        local at1 = Instance.new("Attachment")
  687.                        at1.Parent = torso
  688.                        at1.Visible = vis
  689.                        at1.Orientation = torso.Orientation + Vector3.new(0,180,0)
  690.                        at1.Position = Vector3.new(-1,1,0)
  691.                                        
  692.                        local at1p2 = Instance.new("Attachment")
  693.                        at1p2.Parent = LArm
  694.                        at1p2.Visible = vis
  695.                        at1p2.Orientation = LArm.Orientation + Vector3.new(0,180,0)
  696.                        at1p2.Position = Vector3.new(.5,1,0)
  697.                            
  698.                        local bis = Instance.new("BallSocketConstraint")
  699.                        bis.Parent = LArm
  700.                        bis.Attachment0 = at1
  701.                        bis.Attachment1 = at1p2
  702.                        bis.LimitsEnabled = true
  703.                        bis.UpperAngle = 15
  704.                        bis.Visible = vis2
  705.                        bis.TwistLimitsEnabled = true
  706.                        bis.UpperAngle = -45
  707.                        bis.TwistLowerAngle = -45
  708.                         table.insert(js,1,bis)
  709.                     end
  710.                     if not RArm:FindFirstChild('Dismembered') then    
  711.                         local at2 = Instance.new("Attachment")
  712.                         at2.Parent = torso
  713.                         at2.Visible = vis
  714.                         at2.Orientation = torso.Orientation + Vector3.new(0,0,0)
  715.                         at2.Position = Vector3.new(1,1,0)
  716.                                
  717.                         local at2p2 = Instance.new("Attachment")
  718.                         at2p2.Parent = RArm
  719.                         at2p2.Visible = vis
  720.                         at2p2.Orientation = RArm.Orientation + Vector3.new(0,0,0)
  721.                         at2p2.Position = Vector3.new(-.5,1,0)
  722.                        
  723.                         local bis2 = Instance.new("BallSocketConstraint")
  724.                         bis2.Parent = RArm
  725.                         bis2.Attachment0 = at2
  726.                         bis2.Attachment1 = at2p2
  727.                         bis2.LimitsEnabled = true
  728.                         bis2.UpperAngle = 15
  729.                         bis2.Visible = vis2
  730.                         bis2.TwistLimitsEnabled = true
  731.                         bis2.UpperAngle = -45
  732.                         bis2.TwistLowerAngle = -45
  733.                         table.insert(js,1,bis2)
  734.                     end
  735.                      if not RLeg:FindFirstChild('Dismembered') then
  736.                         local at3 = Instance.new("Attachment")
  737.                         at3.Parent = torso
  738.                         at3.Visible = vis
  739.                         at3.Orientation = torso.Orientation + Vector3.new(90,0,-90)
  740.                         at3.Position = Vector3.new(.5,-1,0)
  741.                                
  742.                         local at3p2 = Instance.new("Attachment")
  743.                         at3p2.Parent = RLeg
  744.                         at3p2.Visible = vis
  745.                         at3p2.Orientation = RLeg.Orientation + Vector3.new(90,0,-90)
  746.                         at3p2.Position = Vector3.new(0,1,0)
  747.                        
  748.                         local bis3 = Instance.new("BallSocketConstraint")
  749.                         bis3.Parent = RLeg
  750.                         bis3.Attachment0 = at3
  751.                         bis3.Attachment1 = at3p2
  752.                         bis3.LimitsEnabled = true
  753.                         bis3.UpperAngle = 180-15
  754.                         bis3.Visible = vis2
  755.                         table.insert(js,1,bis3)
  756.                     end
  757.                          
  758.                     if not LLeg:FindFirstChild('Dismembered') then  
  759.                         local at4 = Instance.new("Attachment")
  760.                         at4.Parent = torso
  761.                         at4.Visible = vis
  762.                         at4.Orientation = torso.Orientation + Vector3.new(90,0,-90)
  763.                         at4.Position = Vector3.new(-.5,-1,0)
  764.                                
  765.                         local at4p2 = Instance.new("Attachment")
  766.                         at4p2.Parent = LLeg
  767.                         at4p2.Visible = vis
  768.                         at4p2.Orientation = LLeg.Orientation + Vector3.new(90,0,-90)
  769.                         at4p2.Position = Vector3.new(0,1,0)
  770.                    
  771.                         local bis4 = Instance.new("BallSocketConstraint")
  772.                         bis4.Parent = LLeg
  773.                         bis4.Attachment0 = at4
  774.                         bis4.Attachment1 = at4p2
  775.                         bis4.LimitsEnabled = true
  776.                         bis4.UpperAngle = 180-15
  777.                         bis4.Visible = vis2
  778.                         table.insert(js,1,bis4)
  779.                     end
  780.                    
  781.                     if not headless and not head:FindFirstChild('Dismembered') then  
  782.                             local at5 = Instance.new("Attachment")
  783.                             at5.Parent = torso
  784.                             at5.Visible = vis
  785.                             at5.Orientation = torso.Orientation + Vector3.new(180,90,0)
  786.                             at5.Position = Vector3.new(0,1,0)
  787.                          
  788.                             local at5p2 = Instance.new("Attachment")
  789.                             at5p2.Parent = head
  790.                             at5p2.Visible = vis
  791.                             at5p2.Orientation = head.Orientation + Vector3.new(180,90,0)
  792.                             at5p2.Position = Vector3.new(0,-.5,0)
  793.                    
  794.                             local bis5 = Instance.new("BallSocketConstraint")
  795.                             bis5.Parent = head
  796.                             bis5.Attachment0 = at5p2
  797.                             bis5.Attachment1 = at5
  798.                             bis5.LimitsEnabled = true
  799.                             bis5.UpperAngle = 75
  800.                             bis5.Visible = vis2
  801.                             bis5.TwistLimitsEnabled = true
  802.                             bis5.UpperAngle = -45
  803.                             bis5.TwistLowerAngle = -45
  804.                             table.insert(js,1,bis5)
  805.                         else
  806.                             --head:BreakJoints()
  807.                         end
  808.                     end
  809.                 end)
  810.             end
  811.         elseif head and hum then
  812.             hum.BreakJointsOnDeath = false
  813.             if insta then
  814.                 if hum.RigType==Enum.HumanoidRigType.R15 then
  815.                     for _,v in pairs(pc:GetDescendants()) do
  816.                         if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then
  817.                             if not kill then
  818.                                 table.insert(js2,1,{obj = v,par = v.Parent})
  819.                                 v.Parent = nil
  820.                             elseif kill then
  821.                                 v:Destroy()
  822.                             end
  823.                         end
  824.                     end
  825.                     local vis = false
  826.                     local vis2 = false
  827.                        
  828.                     if not LF:FindFirstChild('Dismembered') then  
  829.                         local bsc1 = Instance.new("BallSocketConstraint",LF)
  830.                         bsc1.Attachment0 = LF.LeftAnkleRigAttachment
  831.                         bsc1.Attachment1 = LLL.LeftAnkleRigAttachment
  832.                         table.insert(js,1,bsc1)
  833.                     end
  834.                     if not LLL:FindFirstChild('Dismembered') then  
  835.                         local bsc2 = Instance.new("BallSocketConstraint",LLL)
  836.                         bsc2.Attachment0 = LLL.LeftKneeRigAttachment
  837.                         bsc2.Attachment1 = LUL.LeftKneeRigAttachment
  838.                         table.insert(js,1,bsc2)
  839.                     end
  840.                     if not LUL:FindFirstChild('Dismembered') then  
  841.                         local bsc3 = Instance.new("BallSocketConstraint",LUL)
  842.                         bsc3.Attachment0 = LUL.LeftHipRigAttachment
  843.                         bsc3.Attachment1 = LT.LeftHipRigAttachment
  844.                         table.insert(js,1,bsc3)
  845.                     end
  846.                     if not RF:FindFirstChild('Dismembered') then  
  847.                         local bsc4 = Instance.new("BallSocketConstraint",RF)
  848.                         bsc4.Attachment0 = RF.RightAnkleRigAttachment
  849.                         bsc4.Attachment1 = RLL.RightAnkleRigAttachment
  850.                         table.insert(js,1,bsc4)
  851.                     end
  852.                     if not RLL:FindFirstChild('Dismembered') then  
  853.                         local bsc5 = Instance.new("BallSocketConstraint",RLL)
  854.                         bsc5.Attachment0 = RLL.RightKneeRigAttachment
  855.                         bsc5.Attachment1 = RUL.RightKneeRigAttachment
  856.                         table.insert(js,1,bsc5)
  857.                     end
  858.                     if not RUL:FindFirstChild('Dismembered') then  
  859.                         local bsc6 = Instance.new("BallSocketConstraint",RUL)
  860.                         bsc6.Attachment0 = RUL.RightHipRigAttachment
  861.                         bsc6.Attachment1 = LT.RightHipRigAttachment
  862.                         table.insert(js,1,bsc6)
  863.                     end
  864.                     if not LH:FindFirstChild('Dismembered') then  
  865.                         local bsc7 = Instance.new("BallSocketConstraint",LH)
  866.                         bsc7.Attachment0 = LH.LeftWristRigAttachment
  867.                         bsc7.Attachment1 = LLA.LeftWristRigAttachment
  868.                         table.insert(js,1,bsc7)
  869.                     end
  870.                     if not LLA:FindFirstChild('Dismembered') then  
  871.                         local bsc8 = Instance.new("BallSocketConstraint",LLA)
  872.                         bsc8.Attachment0 = LLA.LeftElbowRigAttachment
  873.                         bsc8.Attachment1 = LUA.LeftElbowRigAttachment
  874.                         table.insert(js,1,bsc8)
  875.                     end
  876.                     if not LUA:FindFirstChild('Dismembered') then  
  877.                         local bsc9 = Instance.new("BallSocketConstraint",LUA)
  878.                         bsc9.Attachment0 = LUA.LeftShoulderAttachment
  879.                         bsc9.Attachment1 = UT.LeftCollarAttachment
  880.                         table.insert(js,1,bsc9)
  881.                     end
  882.                     if not RH:FindFirstChild('Dismembered') then  
  883.                         local bsc10 = Instance.new("BallSocketConstraint",RH)
  884.                         bsc10.Attachment0 = RH.RightWristRigAttachment
  885.                         bsc10.Attachment1 = RLA.RightWristRigAttachment
  886.                         table.insert(js,1,bsc10)
  887.                     end
  888.                     if not RLA:FindFirstChild('Dismembered') then  
  889.                         local bsc11 = Instance.new("BallSocketConstraint",RLA)
  890.                         bsc11.Attachment0 = RLA.RightElbowRigAttachment
  891.                         bsc11.Attachment1 = RUA.RightElbowRigAttachment
  892.                         table.insert(js,1,bsc11)
  893.                     end
  894.                     if not RUA:FindFirstChild('Dismembered') then  
  895.                         local bsc12 = Instance.new("BallSocketConstraint",RUA)
  896.                         bsc12.Attachment0 = RUA.RightShoulderAttachment
  897.                         bsc12.Attachment1 = UT.RightCollarAttachment
  898.                         table.insert(js,1,bsc12)
  899.                     end
  900.                     if not LT:FindFirstChild('Dismembered') then  
  901.                         local bsc13 = Instance.new("BallSocketConstraint",LT)
  902.                         bsc13.Attachment0 = LT.WaistRigAttachment
  903.                         bsc13.Attachment1 = UT.WaistRigAttachment
  904.                         table.insert(js,1,bsc13)
  905.                     end
  906.                     if not headless and not head:FindFirstChild('Dismembered')  then
  907.                         local bsc14 = Instance.new("BallSocketConstraint",head)
  908.                         bsc14.Attachment0 = UT.NeckRigAttachment
  909.                         bsc14.Attachment1 = head.NeckRigAttachment
  910.                         bsc14.LimitsEnabled = true
  911.                         bsc14.UpperAngle = -75
  912.                         bsc14.TwistLimitsEnabled = true
  913.                         bsc14.UpperAngle = -45
  914.                         bsc14.TwistLowerAngle = -45
  915.                         table.insert(js,1,bsc14)
  916.                     else
  917.                         --head:BreakJoints()
  918.                     end
  919.                 end
  920.             else
  921.                 hum.Died:Connect(function()
  922.                     if hum.RigType==Enum.HumanoidRigType.R15 then
  923.                         for _,v in pairs(pc:GetDescendants()) do
  924.                             if (v:IsA('Motor6D') or v:IsA('Motor') or v:IsA("BallSocketConstraint")) and (not string.match(v.Name:lower(),'root')) then
  925.                                 if not kill then
  926.                                     table.insert(js2,1,{obj = v,par = v.Parent})
  927.                                     v.Parent = nil
  928.                                 elseif kill then
  929.                                     v:Destroy()
  930.                                 end
  931.                             end
  932.                         end
  933.                         local vis = false
  934.                         local vis2 = false
  935.                            
  936.                         if not LF:FindFirstChild('Dismembered') then  
  937.                             local bsc1 = Instance.new("BallSocketConstraint",LF)
  938.                             bsc1.Attachment0 = LF.LeftAnkleRigAttachment
  939.                             bsc1.Attachment1 = LLL.LeftAnkleRigAttachment
  940.                             table.insert(js,1,bsc1)
  941.                         end
  942.                         if not LLL:FindFirstChild('Dismembered') then  
  943.                             local bsc2 = Instance.new("BallSocketConstraint",LLL)
  944.                             bsc2.Attachment0 = LLL.LeftKneeRigAttachment
  945.                             bsc2.Attachment1 = LUL.LeftKneeRigAttachment
  946.                             table.insert(js,1,bsc2)
  947.                         end
  948.                         if not LUL:FindFirstChild('Dismembered') then  
  949.                             local bsc3 = Instance.new("BallSocketConstraint",LUL)
  950.                             bsc3.Attachment0 = LUL.LeftHipRigAttachment
  951.                             bsc3.Attachment1 = LT.LeftHipRigAttachment
  952.                             table.insert(js,1,bsc3)
  953.                         end
  954.                         if not RF:FindFirstChild('Dismembered') then  
  955.                             local bsc4 = Instance.new("BallSocketConstraint",RF)
  956.                             bsc4.Attachment0 = RF.RightAnkleRigAttachment
  957.                             bsc4.Attachment1 = RLL.RightAnkleRigAttachment
  958.                             table.insert(js,1,bsc4)
  959.                         end
  960.                         if not RLL:FindFirstChild('Dismembered') then  
  961.                             local bsc5 = Instance.new("BallSocketConstraint",RLL)
  962.                             bsc5.Attachment0 = RLL.RightKneeRigAttachment
  963.                             bsc5.Attachment1 = RUL.RightKneeRigAttachment
  964.                             table.insert(js,1,bsc5)
  965.                         end
  966.                         if not RUL:FindFirstChild('Dismembered') then  
  967.                             local bsc6 = Instance.new("BallSocketConstraint",RUL)
  968.                             bsc6.Attachment0 = RUL.RightHipRigAttachment
  969.                             bsc6.Attachment1 = LT.RightHipRigAttachment
  970.                             table.insert(js,1,bsc6)
  971.                         end
  972.                         if not LH:FindFirstChild('Dismembered') then  
  973.                             local bsc7 = Instance.new("BallSocketConstraint",LH)
  974.                             bsc7.Attachment0 = LH.LeftWristRigAttachment
  975.                             bsc7.Attachment1 = LLA.LeftWristRigAttachment
  976.                             table.insert(js,1,bsc7)
  977.                         end
  978.                         if not LLA:FindFirstChild('Dismembered') then  
  979.                             local bsc8 = Instance.new("BallSocketConstraint",LLA)
  980.                             bsc8.Attachment0 = LLA.LeftElbowRigAttachment
  981.                             bsc8.Attachment1 = LUA.LeftElbowRigAttachment
  982.                             table.insert(js,1,bsc8)
  983.                         end
  984.                         if not LUA:FindFirstChild('Dismembered') then  
  985.                             local bsc9 = Instance.new("BallSocketConstraint",LUA)
  986.                             bsc9.Attachment0 = LUA.LeftShoulderAttachment
  987.                             bsc9.Attachment1 = UT.LeftCollarAttachment
  988.                             table.insert(js,1,bsc9)
  989.                         end
  990.                         if not RH:FindFirstChild('Dismembered') then  
  991.                             local bsc10 = Instance.new("BallSocketConstraint",RH)
  992.                             bsc10.Attachment0 = RH.RightWristRigAttachment
  993.                             bsc10.Attachment1 = RLA.RightWristRigAttachment
  994.                             table.insert(js,1,bsc10)
  995.                         end
  996.                         if not RLA:FindFirstChild('Dismembered') then  
  997.                             local bsc11 = Instance.new("BallSocketConstraint",RLA)
  998.                             bsc11.Attachment0 = RLA.RightElbowRigAttachment
  999.                             bsc11.Attachment1 = RUA.RightElbowRigAttachment
  1000.                             table.insert(js,1,bsc11)
  1001.                         end
  1002.                         if not RUA:FindFirstChild('Dismembered') then  
  1003.                             local bsc12 = Instance.new("BallSocketConstraint",RUA)
  1004.                             bsc12.Attachment0 = RUA.RightShoulderAttachment
  1005.                             bsc12.Attachment1 = UT.RightCollarAttachment
  1006.                             table.insert(js,1,bsc12)
  1007.                         end
  1008.                         if not LT:FindFirstChild('Dismembered') then  
  1009.                             local bsc13 = Instance.new("BallSocketConstraint",LT)
  1010.                             bsc13.Attachment0 = LT.WaistRigAttachment
  1011.                             bsc13.Attachment1 = UT.WaistRigAttachment
  1012.                             table.insert(js,1,bsc13)
  1013.                         end
  1014.                         if not headless and not head:FindFirstChild('Dismembered')  then
  1015.                             local bsc14 = Instance.new("BallSocketConstraint",head)
  1016.                             bsc14.Attachment0 = UT.NeckRigAttachment
  1017.                             bsc14.Attachment1 = head.NeckRigAttachment
  1018.                             bsc14.LimitsEnabled = true
  1019.                             bsc14.UpperAngle = -75
  1020.                             bsc14.TwistLimitsEnabled = true
  1021.                             bsc14.UpperAngle = -45
  1022.                             bsc14.TwistLowerAngle = -45
  1023.                             table.insert(js,1,bsc14)
  1024.                         else
  1025.                             --head:BreakJoints()
  1026.                         end
  1027.                     end
  1028.                 end)
  1029.             end
  1030.         end
  1031.     end
  1032.     return js,js2
  1033. end
  1034.  
  1035. --function start_saber()
  1036.     function blow(hit)
  1037.         local targchar,targtorso,targhum,killval,hitval,finishval
  1038.         pcall(function()
  1039.             targchar = hit.Parent
  1040.         end)
  1041.         pcall(function()
  1042.             targtorso = targchar:FindFirstChild("Torso") or targchar:FindFirstChild("HumanoidRootPart")
  1043.         end)
  1044.         pcall(function()
  1045.             targhum = targchar:FindFirstChildOfClass("Humanoid")
  1046.         end)
  1047.         pcall(function()
  1048.             killval = targhum:FindFirstChild("killer")
  1049.         end)
  1050.         pcall(function()
  1051.             hitval = targhum:FindFirstChild("hit " .. plr.Name)
  1052.         end)
  1053.         pcall(function()
  1054.             finishval = targhum:FindFirstChild("finishing")
  1055.         end)
  1056.         if CheckIfAlive() and targchar and targhum and targhum ~= hum and hum and not killval and not hitval and not finishval and attacking and damaging then
  1057.             local temphitval = Instance.new("ObjectValue",targhum)
  1058.             temphitval.Name = ("hit " .. plr.Name)
  1059.             game:GetService("Debris"):AddItem(temphitval,.6)
  1060.             if targhum.Health > 0 then
  1061.                 targhum:TakeDamage(damage)
  1062.             end
  1063.             if 0 >= targhum.Health then
  1064.                 local tempkillval = Instance.new("ObjectValue",targhum)
  1065.                 tempkillval.Name = "killer"
  1066.                 tempkillval.Value = plr
  1067.                 Ragdoll(targchar,false,true,true)
  1068.             end
  1069.             hitsound.TimePosition = 0.3
  1070.             hitsound.PlaybackSpeed = math.random(10,11)/10
  1071.             hitsound:Play()
  1072.         elseif not CheckIfAlive() then
  1073.             --[[tool.Parent = workspace]]
  1074.         end
  1075.     end
  1076.     function attack()
  1077.         swingsound.PlaybackSpeed = math.random(95,105)/100
  1078.         swingsound.SoundId = 'rbxassetid://' .. swings[math.random(1,#swings)]
  1079.         swingsound:play()
  1080.         animval = animval + 1
  1081.         if animval > #anims then animval = 1 end
  1082.         animation.AnimationId = "rbxassetid://" .. anims[animval]
  1083.         swinganim = hum:LoadAnimation(animation)
  1084.         if animval == 1 then
  1085.             swinganim:Play(.05,1,1.5) -- front swing
  1086.         elseif animval == 2 then
  1087.             tool.Grip = CFrame.new(2.29999948, 0.0200000294, 0.029999923, -1, 8.74227766e-08, 0, -8.74227766e-08, -1, 0, 0, 0, 1)
  1088.             swinganim:Play(.04,1,1.7) -- left swing
  1089.         elseif animval == 3 then
  1090.             --tool.Grip = CFrame.new(-0.0644850433, -0.192117706, 1.77630055, 4.37113883e-08, 1, -4.37113847e-08, -1, 4.37113883e-08, 4.37113918e-08, 4.37113918e-08, 4.37113847e-08, 1)
  1091.             swinganim:Play(.04,1,1.5) -- right swing
  1092.         end
  1093.     end
  1094.     function CheckIfAlive()
  1095.         local alive = false
  1096.         if (plr and plr.Parent and char and char.Parent and hum and hum.Parent and hum.Health > 0 and torso and torso.Parent) then
  1097.             alive = true
  1098.         end
  1099.         return alive
  1100.     end
  1101.     function Activated()
  1102.         if (10 >= stamina) or attacking or equipping or not CheckIfAlive() then return end
  1103.        
  1104.         attacking = true
  1105.        
  1106.         stamina = stamina - 10
  1107.         stamina_counter = 1
  1108.         attack()
  1109.         damaging = true
  1110.         Trail.Enabled = true
  1111.         wait(.6)
  1112.        
  1113.         damaging = false
  1114.         tool.Grip = CFrame.new(2.29999948, 0.0200000294, 0.029999923, -4.37113883e-08, -1, 0, 1, -4.37113883e-08, 0, 0, 0, 1)
  1115.         hum.WalkSpeed = 16
  1116.    
  1117.         Trail.Enabled = false
  1118.         attacking = false
  1119.     end
  1120.     function create_gui(p)
  1121.         local screen = Instance.new("ScreenGui")
  1122.         local Frame1 = Instance.new("Frame")
  1123.         local Frame2 = Instance.new("Frame")
  1124.         local staminabar = Instance.new("Frame")
  1125.         local staminastat = Instance.new("TextBox")
  1126.         local TextLabel5 = Instance.new("TextLabel")
  1127.         local Frame6 = Instance.new("Frame")
  1128.         local healthbar = Instance.new("Frame")
  1129.         local TextLabel8 = Instance.new("TextLabel")
  1130.         local healthstat = Instance.new("TextBox")
  1131.         local Frame10 = Instance.new("Frame")
  1132.         local blockbar = Instance.new("Frame")
  1133.         local blockstat = Instance.new("TextBox")
  1134.         local TextLabel13 = Instance.new("TextLabel")
  1135.         screen.Parent = p
  1136.         screen.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  1137.         Frame1.Parent = screen
  1138.         Frame1.Size = UDim2.new(1, 0, 1, 0)
  1139.         Frame1.BackgroundColor = BrickColor.new("Institutional white")
  1140.         Frame1.BackgroundColor3 = Color3.new(1, 1, 1)
  1141.         Frame1.BackgroundTransparency = 1
  1142.         Frame2.Name = "Stamina"
  1143.         Frame2.Parent = Frame1
  1144.         Frame2.Position = UDim2.new(0.317999989, 0, 0.899393916, 0)
  1145.         Frame2.Size = UDim2.new(0.331917137, 0, 0.0316969417, 0)
  1146.         Frame2.BackgroundColor = BrickColor.new("Tr. Flu. Blue")
  1147.         Frame2.BackgroundColor3 = Color3.new(0.858824, 0.737255, 1)
  1148.         staminabar.Name = "bar"
  1149.         staminabar.Parent = Frame2
  1150.         staminabar.Size = UDim2.new(1, 0, 1, 0)
  1151.         staminabar.BackgroundColor = BrickColor.new("Fire Yellow")
  1152.         staminabar.BackgroundColor3 = Color3.new(1, 0.941177, 0.27451)
  1153.         staminastat.Name = "stat"
  1154.         staminastat.Parent = Frame2
  1155.         staminastat.Position = UDim2.new(0.325197548, 0, 0, 0)
  1156.         staminastat.Size = UDim2.new(0.5, 0, 1, 0)
  1157.         staminastat.BackgroundColor = BrickColor.new("Institutional white")
  1158.         staminastat.BackgroundColor3 = Color3.new(1, 1, 1)
  1159.         staminastat.BackgroundTransparency = 1
  1160.         staminastat.ZIndex = 3
  1161.         staminastat.Font = Enum.Font.SourceSans
  1162.         staminastat.FontSize = Enum.FontSize.Size24
  1163.         staminastat.Text = tostring(math.floor(stamina)) .. "/" .. tostring(math.floor(staminamax))
  1164.         staminastat.TextColor = BrickColor.new("Institutional white")
  1165.         staminastat.TextColor3 = Color3.new(1, 1, 1)
  1166.         staminastat.TextSize = 20
  1167.         staminastat.TextStrokeTransparency = 0
  1168.         staminastat.TextWrap = true
  1169.         staminastat.TextWrapped = true
  1170.         TextLabel5.Name = "title"
  1171.         TextLabel5.Parent = Frame2
  1172.         TextLabel5.Position = UDim2.new(0.172155678, 0, 0, 0)
  1173.         TextLabel5.Size = UDim2.new(0.5, 0, 1, 0)
  1174.         TextLabel5.BackgroundColor = BrickColor.new("Institutional white")
  1175.         TextLabel5.BackgroundColor3 = Color3.new(1, 1, 1)
  1176.         TextLabel5.BackgroundTransparency = 1
  1177.         TextLabel5.ZIndex = 3
  1178.         TextLabel5.Font = Enum.Font.SourceSans
  1179.         TextLabel5.FontSize = Enum.FontSize.Size24
  1180.         TextLabel5.Text = "Stamina:"
  1181.         TextLabel5.TextColor = BrickColor.new("Institutional white")
  1182.         TextLabel5.TextColor3 = Color3.new(1, 1, 1)
  1183.         TextLabel5.TextSize = 20
  1184.         TextLabel5.TextStrokeTransparency = 0
  1185.         TextLabel5.TextWrap = true
  1186.         TextLabel5.TextWrapped = true
  1187.         Frame6.Name = "Health"
  1188.         Frame6.Parent = Frame1
  1189.         Frame6.Position = UDim2.new(0.317578763, 0, 0.859090745, 0)
  1190.         Frame6.Size = UDim2.new(0.332338333, 0, 0.0316969417, 0)
  1191.         Frame6.BackgroundColor = BrickColor.new("Persimmon")
  1192.         Frame6.BackgroundColor3 = Color3.new(1, 0.25098, 0.262745)
  1193.         healthbar.Name = "bar"
  1194.         healthbar.Parent = Frame6
  1195.         healthbar.Size = UDim2.new(1, 0, 1, 0)
  1196.         healthbar.BackgroundColor = BrickColor.new("Bright green")
  1197.         healthbar.BackgroundColor3 = Color3.new(0.286275, 1, 0.235294)
  1198.         TextLabel8.Name = "title"
  1199.         TextLabel8.Parent = Frame6
  1200.         TextLabel8.Position = UDim2.new(0.172155678, 0, 0, 0)
  1201.         TextLabel8.Size = UDim2.new(0.5, 0, 1, 0)
  1202.         TextLabel8.BackgroundColor = BrickColor.new("Institutional white")
  1203.         TextLabel8.BackgroundColor3 = Color3.new(1, 1, 1)
  1204.         TextLabel8.BackgroundTransparency = 1
  1205.         TextLabel8.ZIndex = 3
  1206.         TextLabel8.Font = Enum.Font.SourceSans
  1207.         TextLabel8.FontSize = Enum.FontSize.Size24
  1208.         TextLabel8.Text = "Health:"
  1209.         TextLabel8.TextColor = BrickColor.new("Institutional white")
  1210.         TextLabel8.TextColor3 = Color3.new(1, 1, 1)
  1211.         TextLabel8.TextSize = 20
  1212.         TextLabel8.TextStrokeTransparency = 0
  1213.         TextLabel8.TextWrap = true
  1214.         TextLabel8.TextWrapped = true
  1215.         healthstat.Name = "stat"
  1216.         healthstat.Parent = Frame6
  1217.         healthstat.Position = UDim2.new(0.325197548, 0, 0, 0)
  1218.         healthstat.Size = UDim2.new(0.5, 0, 1, 0)
  1219.         healthstat.BackgroundColor = BrickColor.new("Institutional white")
  1220.         healthstat.BackgroundColor3 = Color3.new(1, 1, 1)
  1221.         healthstat.BackgroundTransparency = 1
  1222.         healthstat.ZIndex = 3
  1223.         healthstat.Font = Enum.Font.SourceSans
  1224.         healthstat.FontSize = Enum.FontSize.Size24
  1225.         healthstat.Text = tostring(math.floor(hum.Health)) .. "/" .. tostring(math.floor(hum.MaxHealth))
  1226.         healthstat.TextColor = BrickColor.new("Institutional white")
  1227.         healthstat.TextColor3 = Color3.new(1, 1, 1)
  1228.         healthstat.TextSize = 20
  1229.         healthstat.TextStrokeTransparency = 0
  1230.         healthstat.TextWrap = true
  1231.         healthstat.TextWrapped = true
  1232.         Frame10.Name = "Block"
  1233.         Frame10.Parent = Frame1
  1234.         Frame10.Position = UDim2.new(0.317999989, 0, 0.940303028, 0)
  1235.         Frame10.Size = UDim2.new(0.331917137, 0, 0.0316969417, 0)
  1236.         Frame10.BackgroundColor = BrickColor.new("Salmon")
  1237.         Frame10.BackgroundColor3 = Color3.new(1, 0.647059, 0.619608)
  1238.         blockbar.Name = "bar"
  1239.         blockbar.Parent = Frame10
  1240.         blockbar.Size = UDim2.new(1, 0, 1, 0)
  1241.         blockbar.BackgroundColor = BrickColor.new("Carnation pink")
  1242.         blockbar.BackgroundColor3 = Color3.new(1, 0.545098, 0.827451)
  1243.         blockstat.Name = "stat"
  1244.         blockstat.Parent = Frame10
  1245.         blockstat.Position = UDim2.new(0.325197548, 0, 0, 0)
  1246.         blockstat.Size = UDim2.new(0.5, 0, 1, 0)
  1247.         blockstat.BackgroundColor = BrickColor.new("Institutional white")
  1248.         blockstat.BackgroundColor3 = Color3.new(1, 1, 1)
  1249.         blockstat.BackgroundTransparency = 1
  1250.         blockstat.ZIndex = 3
  1251.         blockstat.Font = Enum.Font.SourceSans
  1252.         blockstat.FontSize = Enum.FontSize.Size24
  1253.         blockstat.Text = tostring(math.floor(blockhealth)) .. "/" .. tostring(math.floor(blockhealthmax))
  1254.         blockstat.TextColor = BrickColor.new("Institutional white")
  1255.         blockstat.TextColor3 = Color3.new(1, 1, 1)
  1256.         blockstat.TextSize = 20
  1257.         blockstat.TextStrokeTransparency = 0
  1258.         blockstat.TextWrap = true
  1259.         blockstat.TextWrapped = true
  1260.         TextLabel13.Name = "title"
  1261.         TextLabel13.Parent = Frame10
  1262.         TextLabel13.Position = UDim2.new(0.172155678, 0, 0, 0)
  1263.         TextLabel13.Size = UDim2.new(0.5, 0, 1, 0)
  1264.         TextLabel13.BackgroundColor = BrickColor.new("Institutional white")
  1265.         TextLabel13.BackgroundColor3 = Color3.new(1, 1, 1)
  1266.         TextLabel13.BackgroundTransparency = 1
  1267.         TextLabel13.ZIndex = 3
  1268.         TextLabel13.Font = Enum.Font.SourceSans
  1269.         TextLabel13.FontSize = Enum.FontSize.Size24
  1270.         TextLabel13.Text = "Block:"
  1271.         TextLabel13.TextColor = BrickColor.new("Institutional white")
  1272.         TextLabel13.TextColor3 = Color3.new(1, 1, 1)
  1273.         TextLabel13.TextSize = 20
  1274.         TextLabel13.TextStrokeTransparency = 0
  1275.         TextLabel13.TextWrap = true
  1276.         TextLabel13.TextWrapped = true
  1277.         return screen,healthbar,healthstat,staminabar,staminastat,blockbar,blockstat
  1278.     end
  1279.     function update()
  1280.         healthstat.Text = tostring(math.floor(hum.Health)) .. "/" .. tostring(math.floor(hum.MaxHealth))
  1281.         game:GetService("TweenService"):Create(healthbar,TweenInfo.new(.25),{Size = UDim2.new((hum.Health/hum.MaxHealth), 0, 1, 0)}):Play()
  1282.         --
  1283.         staminastat.Text = tostring(math.floor(stamina)) .. "/" .. tostring(math.floor(staminamax))
  1284.         game:GetService("TweenService"):Create(staminabar,TweenInfo.new(.25),{Size = UDim2.new((stamina/staminamax), 0, 1, 0)}):Play()
  1285.         --
  1286.         blockstat.Text = tostring(math.floor(blockhealth)) .. "/" .. tostring(math.floor(blockhealthmax))
  1287.         game:GetService("TweenService"):Create(blockbar,TweenInfo.new(.25),{Size = UDim2.new((blockhealth/blockhealthmax), 0, 1, 0)}):Play()
  1288.     end
  1289.     function clash()
  1290.         att.Position = Vector3.new(handle.Size.X/(math.random(40,70)/100),0,0)
  1291.         spark.Enabled = true
  1292.         shock.Enabled = true
  1293.         glow.Enabled = true
  1294.         spawn(function()
  1295.             wait(0.1)
  1296.             spark.Enabled = false
  1297.             shock.Enabled = false
  1298.             glow.Enabled = false
  1299.         end)
  1300.         blockhealth = blockhealth - 15
  1301.         block_counter = 1
  1302.         spawn(function()
  1303.             local kb = 25
  1304.             local b = Instance.new("BodyVelocity")
  1305.             b.Parent = rootpart
  1306.             b.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  1307.             b.Velocity = rootpart.CFrame.LookVector*(kb)*(-1.25) + Vector3.new(0,1,0)
  1308.             --swinganim:Stop()
  1309.             game:GetService("Debris"):AddItem(b,0.1)
  1310.         end)
  1311.     end
  1312.     function HealthChanged(NewHealth)
  1313.         if hum then
  1314.             if CheckIfAlive() and (CurrentHealth > hum.Health) and (blockhealth >= 15) then
  1315.                 if (0 >= cooldown) and not blocking then
  1316.                     cooldown = 0.6
  1317.                     blocking = true
  1318.                     --selection.Visible = true
  1319.                 end
  1320.                 if blocking and attacking then
  1321.                     clash()
  1322.                     hum.Health = CurrentHealth
  1323.                 else
  1324.                     CurrentHealth = hum.Health
  1325.                     return
  1326.                 end
  1327.                 hitsound.TimePosition = 0.3
  1328.                 hitsound.PlaybackSpeed = math.random(95,105)/100
  1329.                 hitsound:Play()
  1330.             end
  1331.         end
  1332.         CurrentHealth = hum.Health
  1333.     end
  1334.     function Equipped()
  1335.         char = tool.Parent
  1336.         plr = game:GetService("Players"):GetPlayerFromCharacter(char)
  1337.         hum = char:FindFirstChildOfClass("Humanoid")
  1338.         torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
  1339.         swinganim = hum:LoadAnimation(animation)
  1340.         idleanim = hum:LoadAnimation(idleanimation)
  1341.         equipanim = hum:LoadAnimation(equipanimation)
  1342.         screen,healthbar,healthstat,staminabar,staminastat,blockbar,blockstat = create_gui(plr['PlayerGui'])
  1343.         if CheckIfAlive() then
  1344.             equipping = true
  1345.             offsound:Stop()
  1346.             humsound:Resume()
  1347.             onsound:Play()
  1348.             equipanim:Play(.1,.8,2)
  1349.             idleanim:Play(.05,1,1.5)
  1350.             CurrentHealth = hum.Health
  1351.             Connection = hum.HealthChanged:Connect(HealthChanged)
  1352.             spawn(function()
  1353.                 if 0 >= counter then
  1354.                     counter = 1
  1355.                     repeat wait(0.1) until (0 >= counter)
  1356.                     equipping = false
  1357.                 end
  1358.             end)
  1359.         else
  1360.             tool.Parent = workspace
  1361.         end
  1362.     end
  1363.     function Unequipped()
  1364.         hitsound:Stop()
  1365.         swingsound:Stop()
  1366.         onsound:Stop()
  1367.         humsound:Pause()
  1368.         offsound:Play()
  1369.         idleanim:Stop()
  1370.         equipanim:Stop()
  1371.         swinganim:Stop()
  1372.         Connection:Disconnect()
  1373.         if screen then
  1374.             screen:Destroy()
  1375.         end
  1376.     end
  1377.     tool.Equipped:Connect(Equipped)
  1378.     tool.Unequipped:Connect(Unequipped)
  1379.     tool.Activated:Connect(Activated)
  1380.     handle.Touched:Connect(blow)
  1381.     spawn(function()
  1382.         while wait(0.1) and tool and handle do
  1383.             if not CheckIfAlive() then --[[tool.Parent = workspace]] return end
  1384.             pcall(function()
  1385.                 if screen then
  1386.                     update()
  1387.                 end
  1388.             end)
  1389.             if counter > 0 then
  1390.                 counter = counter - 0.1
  1391.             elseif 0 > counter then
  1392.                 counter = 0
  1393.             end
  1394.             if cooldown > 0 then
  1395.                 cooldown = cooldown - 0.1
  1396.                 if resetcooldown >= cooldown then
  1397.                     blocking = false
  1398.                     --selection.Visible = false
  1399.                 end
  1400.             elseif 0 > cooldown then
  1401.                 cooldown = 0
  1402.             end
  1403.             if stamina_counter > 0 then
  1404.                 stamina_counter = stamina_counter - 0.1
  1405.             elseif 0 > stamina_counter then
  1406.                 stamina_counter = 0
  1407.             end
  1408.             if block_counter > 0 then
  1409.                 block_counter = block_counter - 0.1
  1410.             elseif 0 > block_counter then
  1411.                 block_counter = 0
  1412.             end
  1413.         end
  1414.     end)
  1415.     while wait(0.5) do
  1416.         if not CheckIfAlive() then --[[tool.Parent = workspace]] return end
  1417.         if (0 >= stamina_counter) and (staminamax > stamina) then
  1418.             stamina = stamina + 5
  1419.             if (stamina > staminamax) then
  1420.                 stamina = staminamax
  1421.             end
  1422.         elseif 0 > stamina then
  1423.             stamina = 0
  1424.         end
  1425.         if (0 >= block_counter) and (blockhealthmax > blockhealth) then
  1426.             if (0 > blockhealth) then
  1427.                 blockhealth = 0
  1428.             end
  1429.             blockhealth = blockhealth + 7
  1430.             if (blockhealth > blockhealthmax) then
  1431.                 blockhealth = blockhealthmax
  1432.             end
  1433.         elseif (0 > blockhealth) then
  1434.             blockhealth = 0
  1435.         end
  1436.     end
  1437. --end
  1438.  
  1439. --start_saber()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement