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
RunService.Heartbeat:Connect(function()
if mob.Parent ~= nil then
isAttacking = true
canRetreat = true
positionPets(mob.Parent, sentPets)
end
end)
end
end
if mob and isAttacking == true and canRetreat == true then
AttackGui.Attack.Text = "ATTACK"
for i,pets in pairs(sentPets:GetChildren()) do
pets.Parent = equippedPets
RunService.Heartbeat:Connect(function()
if mob.Parent ~= nil then
isAttacking = false
canRetreat = false
positionPets(player.Character, equippedPets)
end
end)
end
end
end
end)
so i think the problem is that im using this in the same uis function but it works just fine until i try to attack after retreating and im printing what isAttacking and canRetreat equal and there not being set back to false