View difference between Paste ID: K6pmTmZR and sBag58vW
SHOW: | | - or go back to the newest paste.
1
local function updateDamage()
2
    local playerPets = playersFolder[player.Name]:GetChildren()
3
    for _, pet in pairs(playerPets) do
4
        local attackValue = pet.Attack.Value
5
        if attackValue then
6
            local drop = attackValue.Parent
7
            local currentPoints = drop.CurrentPoints
8
            currentPoints.Value = math.max(currentPoints.Value - pet.Damage.Value, 0)
9
            if currentPoints.Value == 0 then
10
                for _, pet in pairs(playerPets) do
11
                    pet.Attack.Value = nil
12
                end
13
                for i, item in pairs(drop:GetChildren()) do
14
                    if item.Name == "Reward" then
15
                        remotes.Bank:FireServer("+", item.Value, item.Amount.Value)
16
                    end
17
                end
18
                destroyDrop(drop)
19
            end
20
        end
21
    end
22
end
23