Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make this replay system not go in reverse?

Hello, i have made a really really simple replay system, but the problem is that it goes in reverse.

Here is the script!

local saved = {}
local function track(part)
	local thing = false
	spawn(function()
		for i = 0,10,1 do
			print(i)
			wait(1)
			if i == 10 then
				thing = true
			end
		end
	end)
	while true do
		if thing then break end
		table.insert(saved,1,part.CFrame)
		wait(.1)
	end
end
local function play(part)
	part.Anchored = true
	if saved[1] then
		part.CFrame = saved[1]
		for i,v in pairs(saved) do
			local tween = game.TweenService:Create(part,TweenInfo.new(.1),{CFrame = v})
			tween:Play()
			tween.Completed:Wait()
		end
	end
end
wait(5)
track(game.Workspace.Part)
play(game.Workspace.Part)

Hope i can get this fixed asap!

1 comment

0

Wait i will try playing it backwards!

1 answer

Played it in reverse, works fine now!

local saved = {}
local function track(part)
	local thing = false
	spawn(function()
		for i = 0,10,1 do
			print(i)
			wait(1)
			if i == 10 then
				thing = true
			end
		end
	end)
	while true do
		if thing then break end
		table.insert(saved,1,part.CFrame)
		wait(.1)
	end
end
local function play(part)
	part.Anchored = true
	if saved[1] then
		part.CFrame = saved[1]
		for i = #saved,1,-1 do
			local cf = saved[i]
			local tween = game.TweenService:Create(part,TweenInfo.new(.1),{CFrame = cf})
			tween:Play()
			tween.Completed:Wait()
		end
	end
end
wait(5)
track(game.Workspace.Part)
play(game.Workspace.Part)

This discussion is preserved as it was. New answers, comments, and votes are closed.