UIS.InputBegan:Connect(function(input,gpe)
if gpe then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if mob and isAttacking == false and canAttack == true and canRetreat == false then
AttackGui.Attack.Text = "RETREAT"
for i,pets in pairs(equippedPets:GetChildren()) do
pets.Parent = sentPets
end
SendPets = RunService.RenderStepped:Connect(function()
if mob.Parent ~= nil then
isAttacking = true
canRetreat = true
positionPets(mob.Parent, sentPets)
end
end)
for i,fighter in pairs(sentPets:GetChildren()) do
local anim = fighter:WaitForChild("Animations").Punch
local fighterHum = fighter:WaitForChild("Humanoid")
local punch = fighterHum:LoadAnimation(anim)
punch:Play()
AttackEvent:FireServer(fighter,mob) --THIS ONE
end
end
if mob and isAttacking == true and canAttack and canRetreat == true then
AttackGui.Attack.Text = "ATTACK"
isAttacking = false
canRetreat = false
for i,pets in pairs(sentPets:GetChildren()) do
pets.Parent = equippedPets
end
local RetreatPets = RunService.RenderStepped:Connect(function()
if mob.Parent ~= nil then
positionPets(player.Character, equippedPets)
end
end)
for i,fighter in pairs(equippedPets:GetChildren()) do
RetreatEvent:FireServer(fighter,mob) --THIS ONE
end
if SendPets then
SendPets:Disconnect()
end
end
end
end)
look in the script i showed where the problems are also the animation doesnt play and idk why
ik why its firing multiple times and i think ik a fix but i also want to know why the animations arent playing