Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local events=nil
- local rewinding=false
- local frames=0
- local plrs = game:GetService("Players")
- local plr = plrs.LocalPlayer
- local storepos={}
- local storehp={}
- local storemaxhp = {}
- events=game:GetService("RunService").RenderStepped:Connect(function()
- if not rewinding then
- frames = frames +1
- if not storepos[frames] then
- if plr.Character:FindFirstChild("HumanoidRootPart") then
- storepos[frames] = plr.Character.HumanoidRootPart.CFrame
- end
- end
- end
- end)
- function waitframe(frame)
- for i = 1 , frames do
- game:GetService("RunService").RenderStepped:Wait()
- end
- end
- function ahhhh_it_rewind_time(targetframe)
- if targetframe then
- if not rewinding then
- rewinding = true
- print(targetframe)
- ws=plr.Character.Humanoid.WalkSpeed
- jp=plr.Character.Humanoid.JumpPower
- if #storepos < targetframe then
- targetframe = #storepos
- end
- print(targetframe,frames)
- maxrewindedframe = frames - targetframe
- if maxrewindedframe < 1 then
- maxrewindedframe = 1
- end
- frames = maxrewindedframe
- print("for i=".. tostring(targetframe)..",".. tostring(maxrewindedframe))
- local index=1
- for i=#storepos, maxrewindedframe ,-1 do
- print(i)
- index=i
- game:GetService("RunService").RenderStepped:Wait()
- plr.Character.HumanoidRootPart.CFrame = storepos[i]
- plr.Character.HumanoidRootPart.Anchored = true
- plr.Character.Humanoid.WalkSpeed = 0
- plr.Character.Humanoid.JumpPower = 0
- end
- for i= index+1,#storepos do
- storepos[i] = nil
- end
- plr.Character.Humanoid.WalkSpeed = ws
- plr.Character.Humanoid.JumpPower = jp
- plr.Character.HumanoidRootPart.Anchored = false
- plr.Character.HumanoidRootPart.CFrame = storepos[index]
- rewinding = false
- frames=index
- end
- end
- end
- plr.Chatted:Connect(function(msg)
- if string.sub(msg,1,3) =="/e " then
- msg = string.sub(msg,4)
- end
- if string.sub(msg,1,8) =="Yud_Bet:" then
- print("Called Yud Bet")
- ahhhh_it_rewind_time(tonumber(string.sub(msg,9)) )
- end
- end)
Add Comment
Please, Sign In to add comment