Remove blur effect, and add in a lot of bug fixes like stop replaying animation once the…
- User
Remove blur effect, and add in a lot of bug fixes like stop replaying animation once the rewind/revert is done. And also add in advanced buffers.
-- Advanced Rewind Script with Death Rewind and Enhanced Humanoid States -- Settings local REWIND_KEY = Enum.KeyCode.E -- Key to initiate rewind local RECORD_DURATION = 30 -- Duration to store data in seconds local RECORD_INTERVAL = 0.1 -- How often to record data in seconds local REWIND_SPEED = 1 -- Rewind speed multiplier -- Services local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local Debris = game:GetService("Debris") -- Variables local player = Players.LocalPlayer local data = {} local isRewinding = false local recording = false local rewindConnection local character local humanoid local hrp local lastDeathTime = 0 local characterAddedConnection local humanoidDiedConnection -- UI Setup local ScreenGui = Instance.new("ScreenGui") ScreenGui.Parent = player:WaitForChild("PlayerGui") local RewindLabel = Instance.new("TextLabel") RewindLabel.Size = UDim2.new(0.3, 0, 0.05, 0) RewindLabel.Position = UDim2.new(0.35, 0, 0.9, 0) RewindLabel.BackgroundTransparency = 0.5 RewindLabel.BackgroundColor3 = Color3.fromRGB(0, 0, 0) RewindLabel.TextColor3 = Color3.fromRGB(255, 255, 255) RewindLabel.Font = Enum.Font.SourceSansBold RewindLabel.TextScaled = true RewindLabel.Visible = false RewindLabel.Parent = ScreenGui -- Functions local function startRecording() recording = true -- Start recording data at intervals coroutine.wrap(function() while recording do if character and humanoid and hrp and humanoid.Health > 0 then local frameData = { position = hrp.Position, cframe = hrp.CFrame, velocity = hrp.Velocity, humanoidState = humanoid:GetState(), health = humanoid.Health, animationTracks = {}, timestamp = tick() } -- Record current playing animations for _, track in pairs(humanoid:GetPlayingAnimationTracks()) do table.insert(frameData.animationTracks, {Animation = track.Animation, TimePosition = track.TimePosition}) end table.insert(data, frameData) -- Limit data size if #data > (RECORD_DURATION / RECORD_INTERVAL) then table.remove(data, 1) end end wait(RECORD_INTERVAL) end end)() end local function stopRecording() recording = false end local function startRewind() if not isRewinding and #data > 0 then isRewinding = true RewindLabel.Visible = true RewindLabel.Text = "Rewinding..." -- Apply visual effects local blurEffect = Instance.new("BlurEffect") blurEffect.Size = 0 blurEffect.Parent = game:GetService("Lighting") local blurTween = TweenService:Create(blurEffect, TweenInfo.new(0.5), {Size = 24}) blurTween:Play() -- Stop recording stopRecording() -- Start rewinding local rewindIndex = #data rewindConnection = RunService.RenderStepped:Connect(function(dt) if rewindIndex <= 0 or not isRewinding then stopRewind() return end local frameData = data[rewindIndex] if character and humanoid and hrp then hrp.CFrame = frameData.cframe hrp.Velocity = -frameData.velocity -- Apply humanoid state humanoid:ChangeState(frameData.humanoidState) humanoid.Health = frameData.health -- Handle animations for _, track in pairs(humanoid:GetPlayingAnimationTracks()) do track:Stop() end for _, animData in pairs(frameData.animationTracks) do local animTrack = humanoid:LoadAnimation(animData.Animation) animTrack.TimePosition = animData.TimePosition animTrack:Play() end end rewindIndex = rewindIndex - math.max(1, REWIND_SPEED * dt / RECORD_INTERVAL) end) end end local function stopRewind() isRewinding = false RewindLabel.Visible = false if rewindConnection then rewindConnection:Disconnect() rewindConnection = nil end -- Remove visual effects local blurEffect = game:GetService("Lighting"):FindFirstChildOfClass("BlurEffect") if blurEffect then local blurTween = TweenService:Create(blurEffect, TweenInfo.new(0.5), {Size = 0}) blurTween:Play() blurTween.Completed:Connect(function() blurEffect:Destroy() end) end -- Resume recording startRecording() end -- Character Handling local function onHumanoidDied() lastDeathTime = tick() -- Stop recording stopRecording() -- Keep data for rewinding after death end local function onCharacterAdded(newCharacter) character = newCharacter humanoid = character:WaitForChild("Humanoid") hrp = character:WaitForChild("HumanoidRootPart") -- Disconnect previous death connection if any if humanoidDiedConnection then humanoidDiedConnection:Disconnect() humanoidDiedConnection = nil end humanoidDiedConnection = humanoid.Died:Connect(onHumanoidDied) startRecording() end -- Input Handling UserInputService.InputBegan:Connect(function(input, gameProcessed) if input.KeyCode == REWIND_KEY and not gameProcessed then startRewind() end end) UserInputService.InputEnded:Connect(function(input, gameProcessed) if input.KeyCode == REWIND_KEY and not gameProcessed then stopRewind() end end) -- Start recording when character is added characterAddedConnection = player.CharacterAdded:Connect(onCharacterAdded) -- Handle character already loaded if player.Character then onCharacterAdded(player.Character) end -- Ensure data persists across deaths player.CharacterRemoving:Connect(function(oldCharacter) -- Keep data intact end) -- Handle respawn and rewinding after death player.CharacterAdded:Connect(function(newCharacter) character = newCharacter humanoid = character:WaitForChild("Humanoid") hrp = character:WaitForChild("HumanoidRootPart") -- If the player is rewinding upon respawn, continue rewinding if UserInputService:IsKeyDown(REWIND_KEY) and #data > 0 then startRewind() else -- Start recording anew data = {} startRecording() end end) - Assistant