-- Initialize services local Players = game:GetService("Players") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoidRootPart = character:WaitForChild("HumanoidRootPart") -- Table to store positions with timestamps local positions = {} -- Function to save the player's position every frame local function savePosition() table.insert(positions, { time = tick(), position = humanoidRootPart.Position }) -- Remove positions older than 3 seconds while #positions > 0 and positions[1].time < tick() - 3 do table.remove(positions, 1) end end -- Function to teleport the player to their position from 3 seconds ago local function teleportBack() if #positions > 0 then local lastPosition = positions[1].position humanoidRootPart.CFrame = CFrame.new(lastPosition) end end -- Connect to the RenderStepped event to track the player's position RunService.RenderStepped:Connect(function() savePosition() -- Check if the player has fallen below a certain Y-coordinate (e.g., -100) if humanoidRootPart.Position.Y < -100 then teleportBack() end end)