I would like to record past positions of a character with a table. However, I keep getting this error when trying to print the position table ![]()
local RS = game:GetService("ReplicatedStorage")
local Run = game:GetService("RunService")
local plrs = game:GetService("Players")
local positions = nil
local Pos = {}
plrs.PlayerAdded:Connect(function(player)
table.insert(Pos, 'checking')
end)
local function logPosition(plr)
if plr:IsDescendantOf(workspace) then
local curPos = plr:FindFirstChild("HumanoidRootPart").Position
print(curPos)
table.insert(Pos, curPos)
print(table.getn(Pos))
print(table.concat(Pos, " "))
end
end
while true and wait(2) do
for i,v in pairs(plrs:GetChildren()) do
plr = game:GetService("Workspace"):WaitForChild(v.Name)
if table.getn(Pos)+1 <= 5 then
logPosition(plr)
else
table.remove(Pos, 1)
end
end
end