How I Do This Thing?

Please Help I Have Almost No Idea How To Do This:

  1. What do you want to achieve? I Want To Rewind Time By 3 Seconds, Like The Recall Glove In Slap Battles

  2. What is the issue? Almost No Idea How To Do That And Also Not Crashing The Server Because Of Too Much Info In The Table Positions

  3. What solutions have you tried so far? i saw topics close to mine but still didnt helped, in others sites, only showcases

So How I Do It??

3 Likes

Everything is mostly done on the client for the position and stuff as those are replicated so you store the positions on the client instead.

2 Likes

wont that just crash the client?

1 Like

Well it depends on what your doing as you said your rewinding 3 seconds back so it won’t as they only focus on there own character.

2 Likes

If you want time to rewind time for only the client then you can save the player’s characters CFrames for 3 seconds, and then set the CFrames to play backwards. You can also do it on the server since all player’s CFrame’s get replicated to the server.

2 Likes

In Roblox, The Character movement is naturally replicated, so if I change the Cframe on client it will show on the server.

2 Likes

i could just remove info from the table if 3 seconds passed without removing everything but how i do it exactly and how do i rewind the time? i never did something like this before

2 Likes

You store the CFrame in the table and if a table goes from current to past which is default indexing you would go just go down the list and that’s it.

2 Likes

Ok So If The Root CFrame From Character Changes We Put It On The Table, After The 3 Seconds Pass Then He Remove The CFrame IF Not Rewinding Time (Prevent Removing Frames While Rewinding) And If Its To Rewind He Put The CFrame Of The Character Root To The Table Lastest CFrame And Remove It So It Dont Crash Or Lag And Then The Other One Will Be The Lastest And It Repeats Until Theres No More CFrames Or Rewind Is Stopped, So Thats It? When I Can I Will Test And Send The Code If It Dont Work.

1 Like

sorry for you that waited so long but here the code

local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")
local pos = {} --table where is the cframes
local rewind = false
local plr = game.Players.LocalPlayer --player
local char = plr.CharacterAdded:Wait() --wait until character its added
local root = char:WaitForChild("HumanoidRootPart")

uis.InputBegan:Connect(function(inp)
	print(inp.KeyCode)
	if inp.KeyCode == Enum.KeyCode.E then
		rewind = true
		print(pos)
		task.wait(3)
		rewind = false
	end
end)

rs.RenderStepped:Connect(function(dlt)
	if rewind == false and root:IsA("BasePart") then
		local rootpos = root.CFrame
		table.insert(pos,pos) --put the cframe in table
		delay(3,function() --after 3 seconds pass
			local find = table.find(pos,rootpos)
			if find then
				table.remove(pos,find) --remove
			end
		end)
	else
		local cf = pos[#pos] --gets last cframe
		if cf then
			char:PivotTo(cf) --put character in the root cframe
			table.remove(pos,#pos) --and remove it again
		else
			rewind = false
		end
	end
end)

and it gives me this error message

tables cannot be cyclic

and if you print the table this shows up

*** cycle table reference detected ***