Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function destroyDrop(drop)
- task.spawn(function()
- local oldParent = drop.Parent
- drop.Parent = despawnedDrops
- wait(4)
- drop.CurrentPoints.Value = drop.MaxPoints.Value
- drop.Parent = oldParent
- end)
- end
- local function updateDamage()
- local playerPets = playersFolder[player.Name]:GetChildren()
- for _, pet in ipairs(playerPets) do
- local attackValue = pet.Attack.Value
- if attackValue then
- local drop = attackValue.Parent
- local currentPoints = drop.CurrentPoints
- currentPoints.Value = math.max(currentPoints.Value - pet.Damage.Value, 0)
- if currentPoints.Value == 0 then
- for _, pet in pairs(playerPets) do
- pet.Attack.Value = nil
- end
- destroyDrop(drop)
- end
- end
- end
- end
- local function updateDropDisplay()
- local drops = workspace:WaitForChild("Drops"):GetDescendants()
- for _, drop in pairs(drops) do
- if drop:IsA("Model") then
- local display = drop:FindFirstChild("Display")
- local bar = display.Background.Bar
- local displayText = display.Background.Amount
- displayText.Text = tostring(drop.CurrentPoints.Value)
- bar:TweenSize(
- UDim2.fromScale(drop.CurrentPoints.Value / drop.MaxPoints.Value, 1),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Sine,
- 0.3)
- end
- end
- end
- task.spawn(function()
- while task.wait(1) do
- updateDamage()
- updateDropDisplay()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement