Hello there! I’m working on a reverse time script that will track and reverse their positions for learning purpose but I have problem with reversing, I’m logging the positions in table saying
Table[v.Name..","..os.time()] = v.CFrame
The tracks work goods but reversing not Idk where is problem but here is the script
local metatable = {}
metatable.__index = metatable
local class = setmetatable({},metatable)
function metatable.new(PartsTable)
local SelfTable = setmetatable({},self)
SelfTable.__index = SelfTable
SelfTable.Parts = PartsTable
SelfTable.Tracking = false
return SelfTable
end
function metatable:StartTracking(Data)
Data.Tracking = true
spawn(function()
local PositionTable = {}
repeat
for i,v in pairs(Data.Parts) do
PositionTable[v.Name..","..os.time()] = v.CFrame
end
wait()
until Data.Tracking == false
Data.Positions = PositionTable
end)
end
function metatable:StopTracking(Data)
Data.Tracking = false
end
function metatable:Reverse(Data)
for i,v in pairs(Data.Positions) do
local PartPositions = {}
for i,v in pairs(Data.Positions) do
local Spliited = string.split(i,",") -- 1 Part Name , 2 os time
if string.find(i,Spliited[1]) then
PartPositions[i] = v
end
end
for l = #PartPositions,1,-1 do
local splitted = string.split(i,",")
local part = workspace[splitted[1]]
part.CFrame = PartPositions[l]
wait()
end
end
end
return class