Advertisement
drakon-firestone

reszta skryptu DropsClient

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