Advertisement
drakon-firestone

Untitled

Oct 27th, 2024
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1.  
  2. local function destroyDrop(drop)
  3. task.spawn(function()
  4.  
  5. local oldParent = drop.Parent
  6. drop.Parent = despawnedDrops
  7. wait(4)
  8. drop.CurrentPoints.Value = drop.MaxPoints.Value
  9. drop.Parent = oldParent
  10. end)
  11. end
  12.  
  13.  
  14. local function updateDamage()
  15. local playerPets = playersFolder[player.Name]:GetChildren()
  16. for _, pet in ipairs(playerPets) do
  17. local attackValue = pet.Attack.Value
  18. if attackValue then
  19. local drop = attackValue.Parent
  20. local currentPoints = drop.CurrentPoints
  21. currentPoints.Value = math.max(currentPoints.Value - pet.Damage.Value, 0)
  22. if currentPoints.Value == 0 then
  23. for _, pet in pairs(playerPets) do
  24. pet.Attack.Value = nil
  25. end
  26.  
  27. destroyDrop(drop)
  28. end
  29. end
  30. end
  31. end
  32.  
  33.  
  34. local function updateDropDisplay()
  35. local drops = workspace:WaitForChild("Drops"):GetDescendants()
  36. for _, drop in pairs(drops) do
  37. if drop:IsA("Model") then
  38. local display = drop:FindFirstChild("Display")
  39. local bar = display.Background.Bar
  40. local displayText = display.Background.Amount
  41. displayText.Text = tostring(drop.CurrentPoints.Value)
  42. bar:TweenSize(
  43. UDim2.fromScale(drop.CurrentPoints.Value / drop.MaxPoints.Value, 1),
  44. Enum.EasingDirection.Out,
  45. Enum.EasingStyle.Sine,
  46. 0.3)
  47. end
  48. end
  49. end
  50.  
  51.  
  52. task.spawn(function()
  53. while task.wait(1) do
  54. updateDamage()
  55. updateDropDisplay()
  56. end
  57. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement