IHATEMICROWAVEOVEN

full type advantages

Nov 27th, 2021 (edited)
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.37 KB | None | 0 0
  1. -- Type advatages (note these are offensive (e.g. fire is super on grass, grass is nvery on fire)
  2. --[[ The types go in this order dont change the order or it will screw up what beats what
  3. 0 = None (Only for Type2);
  4. 1 = Normal;
  5. 2 = Fire;
  6. 3 = Water;
  7. 4 = Electric;
  8. 5 = Grass;
  9. 6 = Ice;
  10. 7 = Fighting;
  11. 8 = Poison;
  12. 9 = Ground;
  13. 10 = Flying;
  14. 11 = Psychic;
  15. 12 = Bug;
  16. 13 = Rock;
  17. 14 = Ghost;
  18. 15 = Dragon;
  19. 16 = Dark;
  20. 17 = Steel;
  21. 18 = Fairy;
  22. --]]
  23. local nv = 3/5
  24. local sup = 5/3
  25. local imm = 3/10
  26.  
  27. local None = {
  28. 1, -- none
  29. 1, -- normal
  30. 1, -- fire
  31. 1, -- water
  32. 1, -- electric
  33. 1, -- grass
  34. 1, -- ice
  35. 1, -- fighting
  36. 1, -- poison
  37. 1, -- ground
  38. 1, -- flying
  39. 1, -- psychic
  40. 1, -- bug
  41. 1, -- rock
  42. 1, -- ghost
  43. 1, -- dragon
  44. 1, -- dark
  45. 1, -- steel
  46. 1 -- fairy
  47. }
  48. local Normal = {
  49. 1, -- none
  50. 1, -- normal
  51. 1, -- fire
  52. 1, -- water
  53. 1, -- electric
  54. 1, -- grass
  55. 1, -- ice
  56. 1, -- fighting
  57. 1, -- poison
  58. 1, -- ground
  59. 1, -- flying
  60. 1, -- psychic
  61. 1, -- bug
  62. nv, -- rock
  63. imm, -- ghost
  64. 1, -- dragon
  65. 1, -- dark
  66. nv, -- steel
  67. 1 -- fairy
  68. }
  69. local Fire = {
  70. 1, -- none
  71. 1, -- normal
  72. nv, -- fire
  73. nv, -- water
  74. 1, -- electric
  75. sup, -- grass
  76. sup, -- ice
  77. 1, -- fighting
  78. 1, -- poison
  79. 1, -- ground
  80. 1, -- flying
  81. 1, -- psychic
  82. sup, -- bug
  83. nv, -- rock
  84. 1, -- ghost
  85. nv, -- dragon
  86. 1, -- dark
  87. sup, -- steel
  88. 1 -- fairy
  89. }
  90. local Water = {
  91. 1, -- none
  92. 1, -- normal
  93. sup, -- fire
  94. nv, -- water
  95. 1, -- electric
  96. nv, -- grass
  97. 1, -- ice
  98. 1, -- fighting
  99. 1, -- poison
  100. sup, -- ground
  101. 1, -- flying
  102. 1, -- psychic
  103. 1, -- bug
  104. sup, -- rock
  105. 1, -- ghost
  106. nv, -- dragon
  107. 1, -- dark
  108. 1, -- steel
  109. 1 -- fairy
  110. }
  111. local Electric = {
  112. 1, -- none
  113. 1, -- normal
  114. 1, -- fire
  115. sup, -- water
  116. nv, -- electric
  117. nv, -- grass
  118. 1, -- ice
  119. 1, -- fighting
  120. 1, -- poison
  121. imm, -- ground
  122. sup, -- flying
  123. 1, -- psychic
  124. 1, -- bug
  125. 1, -- rock
  126. 1, -- ghost
  127. nv, -- dragon
  128. 1, -- dark
  129. 1, -- steel
  130. 1 -- fairy
  131. }
  132. local Grass = {
  133. 1, -- none
  134. 1, -- normal
  135. nv, -- fire
  136. sup, -- water
  137. 1, -- electric
  138. nv, -- grass
  139. 1, -- ice
  140. 1, -- fighting
  141. 1, -- poison
  142. sup, -- ground
  143. nv, -- flying
  144. 1, -- psychic
  145. nv, -- bug
  146. sup, -- rock
  147. 1, -- ghost
  148. nv, -- dragon
  149. 1, -- dark
  150. nv, -- steel
  151. 1 -- fairy
  152. }
  153. local Ice = {
  154. 1, -- none
  155. 1, -- normal
  156. nv, -- fire
  157. nv, -- water
  158. 1, -- electric
  159. sup, -- grass
  160. nv, -- ice
  161. 1, -- fighting
  162. 1, -- poison
  163. sup, -- ground
  164. sup, -- flying
  165. 1, -- psychic
  166. 1, -- bug
  167. 1, -- rock
  168. 1, -- ghost
  169. sup, -- dragon
  170. 1, -- dark
  171. nv, -- steel
  172. 1 -- fairy
  173. }
  174. local Fighting = {
  175. 1, -- none
  176. sup, -- normal
  177. 1, -- fire
  178. 1, -- water
  179. 1, -- electric
  180. 1, -- grass
  181. sup, -- ice
  182. 1, -- fighting
  183. nv, -- poison
  184. 1, -- ground
  185. nv, -- flying
  186. nv, -- psychic
  187. nv, -- bug
  188. sup, -- rock
  189. imm, -- ghost
  190. 1, -- dragon
  191. sup, -- dark
  192. sup, -- steel
  193. nv -- fairy
  194. }
  195. local Poison = {
  196. 1, -- none
  197. 1, -- normal
  198. 1, -- fire
  199. 1, -- water
  200. 1, -- electric
  201. sup, -- grass
  202. 1, -- ice
  203. 1, -- fighting
  204. nv, -- poison
  205. nv, -- ground
  206. 1, -- flying
  207. 1, -- psychic
  208. 1, -- bug
  209. nv, -- rock
  210. nv, -- ghost
  211. 1, -- dragon
  212. 1, -- dark
  213. imm, -- steel
  214. sup -- fairy
  215. }
  216. local Ground = {
  217. 1, -- none
  218. 1, -- normal
  219. sup, -- fire
  220. 1, -- water
  221. sup, -- electric
  222. nv, -- grass
  223. 1, -- ice
  224. 1, -- fighting
  225. sup, -- poison
  226. 1, -- ground
  227. imm, -- flying
  228. 1, -- psychic
  229. nv, -- bug
  230. sup, -- rock
  231. 1, -- ghost
  232. 1, -- dragon
  233. 1, -- dark
  234. sup, -- steel
  235. 1 -- fairy
  236. }
  237. local Flying = {
  238. 1, -- none
  239. 1, -- normal
  240. 1, -- fire
  241. 1, -- water
  242. nv, -- electric
  243. sup, -- grass
  244. 1, -- ice
  245. sup, -- fighting
  246. 1, -- poison
  247. 1, -- ground
  248. 1, -- flying
  249. 1, -- psychic
  250. sup, -- bug
  251. nv, -- rock
  252. 1, -- ghost
  253. 1, -- dragon
  254. 1, -- dark
  255. nv, -- steel
  256. 1 -- fairy
  257. }
  258. local Psychic = {
  259. 1, -- none
  260. 1, -- normal
  261. 1, -- fire
  262. 1, -- water
  263. 1, -- electric
  264. 1, -- grass
  265. 1, -- ice
  266. sup, -- fighting
  267. sup, -- poison
  268. 1, -- ground
  269. 1, -- flying
  270. nv, -- psychic
  271. 1, -- bug
  272. 1, -- rock
  273. 1, -- ghost
  274. 1, -- dragon
  275. imm, -- dark
  276. nv, -- steel
  277. 1 -- fairy
  278. }
  279. local Bug = {
  280. 1, -- none
  281. 1, -- normal
  282. nv, -- fire
  283. 1, -- water
  284. 1, -- electric
  285. sup, -- grass
  286. 1, -- ice
  287. nv, -- fighting
  288. nv, -- poison
  289. 1, -- ground
  290. nv, -- flying
  291. sup, -- psychic
  292. 1, -- bug
  293. nv, -- rock
  294. nv, -- ghost
  295. 1, -- dragon
  296. sup, -- dark
  297. nv, -- steel
  298. nv -- fairy
  299. }
  300. local Rock = {
  301. 1, -- none
  302. 1, -- normal
  303. sup, -- fire
  304. 1, -- water
  305. 1, -- electric
  306. nv, -- grass
  307. sup, -- ice
  308. nv, -- fighting
  309. 1, -- poison
  310. 1, -- ground
  311. sup, -- flying
  312. 1, -- psychic
  313. sup, -- bug
  314. nv, -- rock
  315. 1, -- ghost
  316. 1, -- dragon
  317. 1, -- dark
  318. nv, -- steel
  319. 1 -- fairy
  320. }
  321. local Ghost = {
  322. 1, -- none
  323. imm, -- normal
  324. 1, -- fire
  325. 1, -- water
  326. 1, -- electric
  327. 1, -- grass
  328. 1, -- ice
  329. 1, -- fighting
  330. 1, -- poison
  331. 1, -- ground
  332. 1, -- flying
  333. sup, -- psychic
  334. 1, -- bug
  335. 1, -- rock
  336. sup, -- ghost
  337. 1, -- dragon
  338. nv, -- dark
  339. 1, -- steel
  340. 1 -- fairy
  341. }
  342. local Dragon = {
  343. 1, -- none
  344. 1, -- normal
  345. 1, -- fire
  346. 1, -- water
  347. 1, -- electric
  348. 1, -- grass
  349. 1, -- ice
  350. 1, -- fighting
  351. 1, -- poison
  352. 1, -- ground
  353. 1, -- flying
  354. 1, -- psychic
  355. 1, -- bug
  356. 1, -- rock
  357. 1, -- ghost
  358. sup, -- dragon
  359. 1, -- dark
  360. nv, -- steel
  361. imm -- fairy
  362. }
  363. local Dark = {
  364. 1, -- none
  365. 1, -- normal
  366. 1, -- fire
  367. 1, -- water
  368. 1, -- electric
  369. 1, -- grass
  370. 1, -- ice
  371. nv, -- fighting
  372. 1, -- poison
  373. 1, -- ground
  374. 1, -- flying
  375. sup, -- psychic
  376. 1, -- bug
  377. 1, -- rock
  378. sup, -- ghost
  379. 1, -- dragon
  380. nv, -- dark
  381. 1, -- steel
  382. nv -- fairy
  383. }
  384. local Steel = {
  385. 1, -- none
  386. 1, -- normal
  387. nv, -- fire
  388. nv, -- water
  389. nv, -- electric
  390. 1, -- grass
  391. sup, -- ice
  392. 1, -- fighting
  393. 1, -- poison
  394. 1, -- ground
  395. 1, -- flying
  396. 1, -- psychic
  397. 1, -- bug
  398. sup, -- rock
  399. 1, -- ghost
  400. 1, -- dragon
  401. 1, -- dark
  402. nv, -- steel
  403. sup -- fairy
  404. }
  405. local Fairy = {
  406. 1, -- none
  407. 1, -- normal
  408. nv, -- fire
  409. 1, -- water
  410. 1, -- electric
  411. 1, -- grass
  412. 1, -- ice
  413. sup, -- fighting
  414. nv, -- poison
  415. 1, -- ground
  416. 1, -- flying
  417. 1, -- psychic
  418. 1, -- bug
  419. 1, -- rock
  420. 1, -- ghost
  421. sup, -- dragon
  422. sup, -- dark
  423. nv, -- steel
  424. 1 -- fairy
  425. }
  426.  
  427. -- LIBRARIES
  428. local STATS = require(game:GetService("ServerScriptService"):WaitForChild("Stats"))
  429. local TOUCH_MANAGER = require(game.ServerScriptService.Libraries.OnTouched)
  430.  
  431. local BOSS_HOLDER = game.Workspace:WaitForChild("BossHolder")
  432.  
  433. local DS_Teams = {}
  434. local DS_Teams_Id = 1
  435.  
  436. local DamageService = {}
  437.  
  438. -- TEAMS
  439.  
  440. function DamageService:RegisterTeam(tab)
  441. local CID = DS_Teams_Id DS_Teams_Id = DS_Teams_Id + 1
  442. DS_Teams[CID] = {}
  443. for _, i in pairs(tab) do
  444. DS_Teams[CID][i.UserId] = true
  445. end
  446.  
  447. local ret = {}
  448. function ret:Disconnect()
  449. DS_Teams[CID] = nil
  450. end
  451. return ret
  452. end
  453.  
  454. function DamageService:IsTeamed(Handler, Target)
  455. if not Handler or not Target then return false end
  456. if not Handler:IsA'Player' or not Target:IsA'Player' then return false end
  457. for _, holder in pairs(DS_Teams) do
  458. if holder[Handler.UserId] then
  459. if holder[Target.UserId] then
  460. return true
  461. end
  462. end
  463. end
  464. return false
  465. end
  466.  
  467. function DamageService:GetPlayer(hit)
  468. if hit.Parent:FindFirstChild("Humanoid") then
  469. local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
  470. if plr then
  471. return plr
  472. else
  473. return hit.Parent
  474. end
  475. end
  476. return nil
  477. end
  478.  
  479. -- DAMAGE
  480.  
  481. function DamageService:CanDamage(Handler, Target)
  482. if not Target then return false end
  483. if Handler == Target then return false end
  484. if Handler ~= nil then
  485. if Handler:IsA'Player' then
  486. if not (STATS.GetStat(Handler, "PvP") == 1) then return false end
  487. if not (STATS.GetStat(Handler, "SLP") == 0) then return false end
  488. if not (Handler.Character) then return false end
  489. if not (Handler.Character:FindFirstChild("Humanoid")) then return false end
  490. if not (Handler.Character.Humanoid.MaxHealth > 0) or not (Handler.Character.Humanoid.Health > 0) then return false end
  491. else
  492. if not (Handler:FindFirstChild("Humanoid")) then return false end
  493. if not (Handler.Humanoid.MaxHealth > 0) or not (Handler.Humanoid.Health > 0) then return false end
  494. if (Handler:FindFirstChild("SLP")) then if not (Handler.SLP.Value == 0) then return false end end
  495. end
  496. end
  497. if Target:IsA'Player' then
  498. if not (STATS.GetStat(Target, "PvP") == 1) then return false end
  499. if not (STATS.GetStat(Target, "CanDamage") == 1) then return false end
  500. if not (Target.Character) then return false end
  501. if not (Target.Character:FindFirstChild("Humanoid")) then return false end
  502. if not (Target.Character.Humanoid.MaxHealth > 0) or not (Target.Character.Humanoid.Health > 0) then return false end
  503. else
  504. if not (Target:FindFirstChild("Humanoid")) then return false end
  505. if not (Target.Humanoid.MaxHealth > 0) or not (Target.Humanoid.Health > 0) then return false end
  506. if (Target:FindFirstChild("SLP")) then if not (Target.SLP.Value == 0) then return false end end
  507. end
  508. if Handler ~= nil then
  509. if Handler:IsA'Player' and Target:IsA'Player' then
  510. if DamageService:IsTeamed(Handler, Target) then return false end
  511. end
  512. end
  513. return true
  514. end
  515.  
  516. function DamageService:CanHeal(Handler, Target)
  517. if not Target then return false end
  518. if Handler == Target then return false end
  519. if Handler ~= nil then
  520. if Handler:IsA'Player' then
  521. if not (STATS.GetStat(Handler, "PvP") == 1) then return false end
  522. if not (STATS.GetStat(Handler, "SLP") == 0) then return false end
  523. if not (Handler.Character) then return false end
  524. if not (Handler.Character:FindFirstChild("Humanoid")) then return false end
  525. if not (Handler.Character.Humanoid.MaxHealth > 0) or not (Handler.Character.Humanoid.Health > 0) then return false end
  526. else
  527. if not (Handler:FindFirstChild("Humanoid")) then return false end
  528. if not (Handler.Humanoid.MaxHealth > 0) or not (Handler.Humanoid.Health > 0) then return false end
  529. if (Handler:FindFirstChild("SLP")) then if not (Handler.SLP.Value == 0 )then return false end end
  530. end
  531. end
  532. if Target:IsA'Player' then
  533. if not (STATS.GetStat(Target, "PvP") == 1) then return false end
  534. if not (Target.Character) then return false end
  535. if not (Target.Character:FindFirstChild("Humanoid")) then return false end
  536. if not (Target.Character.Humanoid.MaxHealth > 0) or not (Target.Character.Humanoid.Health > 0) then return false end
  537. else
  538. if not (Target:FindFirstChild("Humanoid")) then return false end
  539. if not (Target.Humanoid.MaxHealth > 0) or not (Target.Humanoid.Health > 0) then return false end
  540. end
  541. return true
  542. end
  543.  
  544. function DamageService:RegisterDamage(Handler, Target, Damage, AttackType)
  545. if Damage < 0 then return false end
  546. if DamageService:CanDamage(Handler, Target) then
  547. if Target:IsA'Player' then
  548. Target.Character.Humanoid:TakeDamage(math.ceil(Damage * AttackType[STATS.GetStat(Target, "Type") + 1] * AttackType[STATS.GetStat(Target, "Type2") + 1]))
  549. else
  550. local t1
  551. local t2
  552. if Target:FindFirstChild("Type") then t1 = Target.Type elseif Target:FindFirstChild("Type1") then t1 = Target.Type1 else t1 = 0 end
  553. if Target:FindFirstChild("Type2") then t2 = Target.Type2 else t2 = 0 end
  554. Target.Humanoid:TakeDamage(math.ceil(Damage * AttackType[t1 + 1] * AttackType[t2 + 1]))
  555. end
  556. return true
  557. end
  558. return false
  559. end
  560.  
  561. function DamageService:RegisterHeal(Handler, Target, Heal)
  562. if Heal < 0 then return false end
  563. if DamageService:CanHeal(Handler, Target) then
  564. if Target:IsA'Player' then
  565. Target.Character.Humanoid.Health = Target.Character.Humanoid.Health + Heal
  566. else
  567. Target.Humanoid.Health = Target.Humanoid.Health + Heal
  568. end
  569. return true
  570. end
  571. return false
  572. end
  573.  
  574. function DamageService:RegisterWeaponPart(Handler, Parts, Damage, OnHitFunc, Type)
  575. spawn(function()
  576. local attacktype
  577. if not Type then attacktype = None else
  578. local tupe = string.upper(tostring(Type))
  579. if tupe == "1" or tupe == "NOR" or tupe == "NORMAL" then attacktype = Normal end
  580. if tupe == "2" or tupe == "FIR" or tupe == "FIRE" then attacktype = Fire end
  581. if tupe == "3" or tupe == "WAT" or tupe == "WATER" then attacktype = Water end
  582. if tupe == "4" or tupe == "ELE" or tupe == "ELECTRIC" then attacktype = Electric end
  583. if tupe == "5" or tupe == "GRA" or tupe == "GRASS" then attacktype = Grass end
  584. if tupe == "6" or tupe == "ICE" then attacktype = Ice end
  585. if tupe == "7" or tupe == "FIG" or tupe == "FIGHTING" then attacktype = Fighting end
  586. if tupe == "8" or tupe == "POI" or tupe == "POISON" then attacktype = Poison end
  587. if tupe == "9" or tupe == "GRO" or tupe == "GROUND" then attacktype = Ground end
  588. if tupe == "10" or tupe == "FLY" or tupe == "FLYING" then attacktype = Flying end
  589. if tupe == "11" or tupe == "PSY" or tupe == "PSYCHIC" then attacktype = Psychic end
  590. if tupe == "12" or tupe == "BUG" then attacktype = Bug end
  591. if tupe == "13" or tupe == "ROC" or tupe == "ROCK" then attacktype = Rock end
  592. if tupe == "14" or tupe == "GHO" or tupe == "GHOST" then attacktype = Ghost end
  593. if tupe == "15" or tupe == "DRA" or tupe == "DRAGON" then attacktype = Dragon end
  594. if tupe == "16" or tupe == "DAR" or tupe == "DARK" then attacktype = Dark end
  595. if tupe == "17" or tupe == "STE" or tupe == "STEEL" then attacktype = Steel end
  596. if tupe == "18" or tupe == "FAI" or tupe == "FAIRY" then attacktype = Fairy end
  597. if attacktype == nil then attacktype = None end
  598. end
  599. local connections = {}
  600. local debounce = {}
  601. for _, Part in pairs(Parts) do
  602. local connection = TOUCH_MANAGER.Touched(Part, function(hit)
  603. if hit then
  604. local Player = DamageService:GetPlayer(hit)
  605. if Player then
  606. if debounce[Player.Name] == nil then
  607. if DamageService:RegisterDamage(Handler, Player, Damage, attacktype) then
  608. debounce[Player.Name] = true
  609. if OnHitFunc then OnHitFunc(Player) end
  610. end
  611. end
  612. end
  613. end
  614. end)
  615. end
  616. local count = #Parts
  617. repeat
  618. wait(1)
  619. count = 0
  620. for _, Part in pairs(Parts) do
  621. if Part ~= nil then
  622. if Part.Parent ~= nil then
  623. count = count + 1
  624. end
  625. end
  626. end
  627. until count == 0
  628. for _, connection in pairs(connections) do
  629. connection:Disconnect()
  630. end
  631. end)
  632. end
  633.  
  634. function DamageService:RegisterRangeDamage(Handler, Range, Damage, OnHitFunc, Type)
  635. spawn(function()
  636. local attacktype
  637. if not Type then attacktype = None else
  638. local tupe = string.upper(tostring(Type))
  639. if tupe == "1" or tupe == "NOR" or tupe == "NORMAL" then attacktype = Normal end
  640. if tupe == "2" or tupe == "FIR" or tupe == "FIRE" then attacktype = Fire end
  641. if tupe == "3" or tupe == "WAT" or tupe == "WATER" then attacktype = Water end
  642. if tupe == "4" or tupe == "ELE" or tupe == "ELECTRIC" then attacktype = Electric end
  643. if tupe == "5" or tupe == "GRA" or tupe == "GRASS" then attacktype = Grass end
  644. if tupe == "6" or tupe == "ICE" then attacktype = Ice end
  645. if tupe == "7" or tupe == "FIG" or tupe == "FIGHTING" then attacktype = Fighting end
  646. if tupe == "8" or tupe == "POI" or tupe == "POISON" then attacktype = Poison end
  647. if tupe == "9" or tupe == "GRO" or tupe == "GROUND" then attacktype = Ground end
  648. if tupe == "10" or tupe == "FLY" or tupe == "FLYING" then attacktype = Flying end
  649. if tupe == "11" or tupe == "PSY" or tupe == "PSYCHIC" then attacktype = Psychic end
  650. if tupe == "12" or tupe == "BUG" then attacktype = Bug end
  651. if tupe == "13" or tupe == "ROC" or tupe == "ROCK" then attacktype = Rock end
  652. if tupe == "14" or tupe == "GHO" or tupe == "GHOST" then attacktype = Ghost end
  653. if tupe == "15" or tupe == "DRA" or tupe == "DRAGON" then attacktype = Dragon end
  654. if tupe == "16" or tupe == "DAR" or tupe == "DARK" then attacktype = Dark end
  655. if tupe == "17" or tupe == "STE" or tupe == "STEEL" then attacktype = Steel end
  656. if tupe == "18" or tupe == "FAI" or tupe == "FAIRY" then attacktype = Fairy end
  657. if attacktype == nil then attacktype = None end
  658. end
  659. for _, plr in pairs(game.Players:GetPlayers()) do
  660. if plr.Character and Handler.Character then
  661. if plr.Character:FindFirstChild("Torso") and Handler.Character:FindFirstChild("Torso") then
  662. if (Handler.Character.Torso.Position - plr.Character.Torso.Position).magnitude <= Range then
  663. if DamageService:RegisterDamage(Handler, plr, Damage, attacktype) and OnHitFunc then
  664. OnHitFunc(plr)
  665. end
  666. end
  667. end
  668. end
  669. end
  670. for _, boss in pairs(BOSS_HOLDER:GetChildren()) do
  671. if boss:IsA'Model' then
  672. if boss:FindFirstChild("Torso") then
  673. if (boss.Torso.Position - Handler.Character.Torso.Position).magnitude <= Range then
  674. if DamageService:RegisterDamage(Handler, boss, Damage) and OnHitFunc then
  675. OnHitFunc(boss)
  676. end
  677. end
  678. end
  679. end
  680. end
  681. end)
  682. end
  683.  
  684. function DamageService:RegisterHealPart(Handler, Parts, Heal, OnHitFunc)
  685. spawn(function()
  686. local connections = {}
  687. local debounce = {}
  688. for _, Part in pairs(Parts) do
  689. local connection = TOUCH_MANAGER.Touched(Part, function(hit)
  690. if hit then
  691. local Player = DamageService:GetPlayer(hit)
  692. if Player then
  693. if debounce[Player.Name] == nil then
  694. if DamageService:RegisterHeal(Handler, Player, Heal) then
  695. debounce[Player.Name] = true
  696. if OnHitFunc then OnHitFunc(Player) end
  697. end
  698. end
  699. end
  700. end
  701. end)
  702. end
  703. local count = #Parts
  704. repeat
  705. wait(1)
  706. count = 0
  707. for _, Part in pairs(Parts) do
  708. if Part ~= nil then
  709. if Part.Parent ~= nil then
  710. count = count + 1
  711. end
  712. end
  713. end
  714. until count == 0
  715. for _, connection in pairs(connections) do
  716. connection:Disconnect()
  717. end
  718. end)
  719. end
  720.  
  721. function DamageService:RegisterRangeHeal(Handler, Range, Heal, OnHitFunc)
  722. spawn(function()
  723. for _, plr in pairs(game.Players:GetPlayers()) do
  724. if plr.Character and Handler.Character then
  725. if plr.Character:FindFirstChild("Torso") and Handler.Character:FindFirstChild("Torso") then
  726. if (Handler.Character.Torso.Position - plr.Character.Torso.Position).magnitude <= Range then
  727. if DamageService:RegisterHeal(Handler, plr, Heal) and OnHitFunc then
  728. OnHitFunc(plr)
  729. end
  730. end
  731. end
  732. end
  733. end
  734. for _, boss in pairs(BOSS_HOLDER:GetChildren()) do
  735. if boss:IsA'Model' then
  736. if boss:FindFirstChild("Torso") then
  737. if (boss.Torso.Position - Handler.Character.Torso.Position).magnitude <= Range then
  738. if DamageService:RegisterHeal(Handler, boss, Heal) and OnHitFunc then
  739. OnHitFunc(boss)
  740. end
  741. end
  742. end
  743. end
  744. end
  745. end)
  746. end
  747.  
  748. return DamageService
Add Comment
Please, Sign In to add comment