How would I mimic players movement for later?

how would i go about tracking a players movement and then keeping it for later?

Basically I want to track a players movement for a period of time and then make an NPC do it’s exact movement later on.

are there any good methods for this?

2 Likes

You could probably do this, it’s not the most effective but hopefully it’ll help.

Basically what you wanna do is check every interval (this can whatever you want like every second) and store the current position of the player in a table. Here’s what it would look like:

local Interval = 10
local Positions = {}

while task.wait(Interval) do
table.insert(Positions, Player.Character.HumanoidRootPart.Position)
end

Then afterwards when you want to move your NPC to the positions, you can do this:

for i, pos in ipairs(Positions) do
My_NPC:MoveTo(Vector3.new(pos))
end

EDIT: This is a bit simple, you could do a lot like storing the action of each position, like if the Player jumped, etc

3 Likes

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