[HELP] [LUA] Ped stops following when distance is above 4

Hi :slight_smile:
I’m trying to create a dog that will follow me, but when the distance is above 4 it just stop.
this is the task I gave him

local pPed = GetPlayerPed(-1)
local myDog = CreatePed(0, model, x+10, y+10, z, GetEntityHeading(pPed)-180, true, true)
TaskFollowToOffsetOfEntity(myDog, pPed, 1, 1, 0, -1, 10.0,1, true)

anyone?

I would suggest using the following native, rather than the one you’re currently using.

TaskGoToEntity

This will ensure the dog will continue to follow you indefinitely or until you cancel the task.

So try something like this

TaskGoToEntity(myDog, pPed, -1, 0.1, 1.0, 0, 0)

For more information about this native: click here

Well with

TaskGoToEntity(myDog, pPed, -1, 0.1, 1.0, 0, 0)

it does work but now it never stops haha (obviously because of 0.1 in the distance)
if I set it to larger distance it will stop following me once it reached the distance.
I could easily solve it by checking if the distance is greater than lets say 6 and then task again,
But I believe there must be a simpler method.