Hello everyone, So I’ve been stuck on this problem for a while and now and it’s really been bugging me the problem Is that when I check a condition(2) and both are false it tries to re-do that condition im guessing I’ve tried nesting the conditions but nothing seems to work. Code: `while true do
local NearestTarget = CheckNearestTargets()
local randomWaypoint = Waypoints[math.random(1, #Waypoints)].Position
if NearestTarget and CheckSeeingTargets(NearestTarget) then
print("NearestTarget found:", NearestTarget.Name) -- Debug print
else
print("NearestTarget is nil") -- Debug print
Find_Path_Waypoint();
end
game:GetService("RunService").Heartbeat:Wait()
end`
By the way im pretty new so i couldn’t figure out how to format but its in a while loop while constantly being rendered with the game:GetService(“RunService”).Heartbeat:Wait()
Now also if you are still confused, I’ll TRY to break it down more so as you can see if nearestTarget and CheckSeeingTargets(Nearest Target) are both existing/true/valid then it will run and if It’s not it will find way points simple right? Well no. The problem is even THO it clearly states that if nearestTarget and CheckSeeingTargets are both true then run if not find way points it constantly re-calculates path When the player is NEAR which means 1 condition is met, BUT if I go Infront of the AI that’s when it prints Nearest Target Found so the problem even tho both conditions are not met its going directly back to the condition.
Let me understand, the issue you have is that one of the conditions possibly never evaluates to true. If that’s the case, then the problem might be in the function you haven’t shared. If it’s something else, could you explain it better?