Bot is snagging while following

Hello, I’m trying to make my bot walk and yell. The code that I’ll share with you works perfectly except one thing.

Hello, I’m trying to make my bot walk and yell. The code that I’ll share with you works perfectly except one thing.
– SERVICES & INSTANCES –

local chatService = game:GetService("Chat")
local pathfindingservice = game:GetService("PathfindingService")
local userinputservice = game:GetService("UserInputService")

local EventInvoke = game.ReplicatedStorage:WaitForChild("CallArdrisenum")
local Ardrisenum = game.ReplicatedStorage.Ardrisenum
local RealArdrisenum,head,previousWord
previousWord = "sa"
local words = { "5000 PING VAR AMINA KOYIM",
    "NEYE BAKIYON AMCIK",
    "OUTFITI ÇALMA ANANI SIKERIM", 
    "KNIGHT ANANI SIKIM OROSPU ÇOCU",
    "1v1 gel tek ananı sikerim", 
    "ananın amını silivride soğutup sikiyim", 
    "NE VAR LAN SOKUK", 
    "veysel ananın amını hint bülbülü gibi şakırtırım",
    "ORRRRRRRRRRRRRRRRRRRROSSSSSSSSSSSSPU ÇOCUĞUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU",
    "ANANI ZENCİLER SİKSİN OROSPU ÇOCUĞU",
    "GEL LAN BURAYA OROSPU ÇOCUĞU"}

local players = {}

 -- FUNCTIONS --

local function spawning(player)
    
    chatService:Chat(player.Character.Head,"SENİ SEÇTİM PIKACU MERT", "Red")
    
     RealArdrisenum = Ardrisenum:Clone()
    RealArdrisenum.Parent = game.Workspace
    local a,b 
    a = math.random(-20,20)
    b = math.random(-20,20)
    RealArdrisenum.PrimaryPart.CFrame = player.Character.HumanoidRootPart.CFrame + Vector3.new(a,0,b)
    return true
end

local function moving()
    for _,v in pairs(game.Workspace:GetChildren()) do
        local humanoid = v:FindFirstChild("Humanoid")
        if humanoid then
            if game.Players:GetPlayerFromCharacter(v) then
                RealArdrisenum.Humanoid:MoveTo(v.HumanoidRootPart.Position)
                RealArdrisenum.Humanoid.MoveToFinished:Wait()
                while wait() do
                    moving()
                end
            end
        end
    end
end

local function MovingAndSwearing()
    head = RealArdrisenum.Head
    local moving = coroutine.create(moving)
    coroutine.resume(moving)
        while true do
            for _, v in pairs(words) do
                v = words[math.random(#words)]
                if v == previousWord then
                    repeat
                        v = words[math.random(#words)]
                        wait()
                    until v ~= previousWord
                    
                end
                chatService:Chat(head,v)
                previousWord = v
                wait(3)
            end
    end
end

-- POWERING UP --
game.Players.PlayerAdded:Connect(function(player)
    table.insert(players,player)
    print("This server has "..#players.." players, enough for Ardrisenum to kill.")
end)

EventInvoke.OnServerEvent:Connect(function(player)
    if spawning(player)then
        wait(1)
        MovingAndSwearing()
    end
end)

So this is the main code. The problem here is, my bot is not walking smoothly, bot’s more like following the certain point that where i was before, after that it stops for a short moment and follows the last point that I was standing before, this makes the bot seem more laggy but i couldn’t find any solution to that.
here is the example of it: https://youtu.be/4vW5AEp7WHI

How can I solve the issue?
Thanks.

1 Like

Remove the wait(1) at the end, replace it with an empty wait()

1 Like