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.
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
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.
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.
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)