attacks = PlayersAttackSelect()
for i,v in pairs (attacks) do
if v.Target.BattleInfo.Alive.Value == false then v.Target = Enemies[math.random(1,#Enemies)] end -- This line
PlayerAttacks(v.Attacker,v.Attack,v.Target,PlrsChar,Stage)
for i,v in pairs (Enemies) do
if Enemies[i].BattleInfo.Alive.Value == false then
Enemies[i]:Destroy()
table.remove(Enemies,i)
end
end
if next(Enemies) == nil then BattleActive = false end
end
If the Target dies, then it’s model get destroyed, but when other players are trying to attack the same target, he’s not there (and thus the script stops). I need a way to detect that the Target Model is not there anymore so the game selects a new target.
Edit: I’ll just take the complicated path.