Coding a follow system for characters like anime vanguards

Im wondering how you would go about making a character follow system sort of thing similair to anime vanguards. The idea is that i have characters following the player around. right now im not thinking about anims just wanna get the follow system to work.

Ive tried by having welds attached the dummy and the player character, it just results in the players character moving really slow and after doing a bunch of research i cant find a solution. I also tried scripting the dummy to follow the player but and it works but it vibrates/lags its really weird. i tried lerping and adding a loop to make it move to the position of the character more frequently but it doesnt work.

heres the script (put in serverscript service):

local RunService = game:GetService("RunService")

game.Players.PlayerAdded:Connect(function(plr)
    wait(5) -- Wait 5 seconds after the player joins
    local dummy = game.Workspace:FindFirstChild("1") -- Find the dummy named "1"

    if dummy and dummy:FindFirstChild("HumanoidRootPart") and dummy:FindFirstChild("Humanoid") then
        local humanoid = dummy.Humanoid

        RunService.Heartbeat:Connect(function()
            if plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then
                local playerRoot = plr.Character.HumanoidRootPart

                -- Create the offset (2 studs to the left, 3 studs behind the player)
                local offset = playerRoot.CFrame.RightVector * -2 + playerRoot.CFrame.LookVector * -3
                local targetPosition = playerRoot.Position + offset

                -- Update the dummy's position and rotation to match the player
                dummy.HumanoidRootPart.CFrame = CFrame.new(targetPosition, targetPosition + playerRoot.CFrame.LookVector)

                -- Move the dummy smoothly to the target position
                if (dummy.HumanoidRootPart.Position - targetPosition).Magnitude > 0.1 then
                    humanoid:MoveTo(targetPosition)
                end
            end
        end)
    end
end)

Any ideas would be greatly appreciated thanks.

Hmm have you tried using an AlignPosition?

yeah it did the same thing as a weld, it slowed the players walkspeed down a bunch. I turned off the mass of the follow dummy and turned off collisions but it still didnt work. Align orientation works though to keep it facing the correct direction. its just the position which bugs out.

You should turn on Massless for everybody part in the dummy.

If KingVamp’s solution doesn’t work of turning on massless for all parts, try using a Motor6D to have a movable joint.

continue having it following the player but use Runservice.Renderstepped instead of heartbeat.

Edit: After looking a bit closer this is a server script which is the reason for it being laggy when following the player. What you should do is have all the following and movement be done on the client and then have a server script calculate the actual positions for where the other characters are so that way if the characters are moved locally with hacks then the characters still respond how they should if they weren’t moved locally.

1 Like

Yeah but then other players wouldnt be able to see cuz it would be done client side.

motor6d slows down the player too.

but i did try it, and it works smoothly its just other players cant see so that doesnt work

Did you try what I suggested here?

yeah i did, it still slows the player down its super weird

For an1 with the same problem i used motor6d and turned platformStand on on the dummy

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.