
Keyless

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
---------------------------------------------------
-- SETTINGS
---------------------------------------------------
local FALL_DISTANCE = 25
local LOCK_TIME = 0.75
---------------------------------------------------
-- VARIABLES
---------------------------------------------------
local character
local humanoid
local rootPart
local enabled = true
local teleporting = false
local lastSafeCFrame = nil
local highestY = nil
---------------------------------------------------
-- UI (UNCHANGED)
---------------------------------------------------
local gui = Instance.new("ScreenGui")
gui.Name = "FallReturnUI"
gui.ResetOnSpawn = false
gui.Parent = player:WaitForChild("PlayerGui")
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 145, 0, 38)
frame.Position = UDim2.new(0, 15, 0, 15)
frame.BackgroundColor3 = Color3.fromRGB(38, 38, 38)
frame.BorderSizePixel = 0
frame.Parent = gui
Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 7)
local button = Instance.new("TextButton")
button.Size = UDim2.new(1, -8, 1, -8)
button.Position = UDim2.new(0, 4, 0, 4)
button.BackgroundColor3 = Color3.fromRGB(58, 58, 58)
button.TextColor3 = Color3.new(1,1,1)
button.Font = Enum.Font.GothamBold
button.TextSize = 13
button.BorderSizePixel = 0
button.Parent = frame
Instance.new("UICorner", button).CornerRadius = UDim.new(0, 6)
local function updateButton()
button.Text = enabled and "Fall Return : ON" or "Fall Return : OFF"
end
updateButton()
button.MouseButton1Click:Connect(function()
enabled = not enabled
updateButton()
end)
---------------------------------------------------
-- CHARACTER
---------------------------------------------------
local function setupCharacter(char)
character = char
humanoid = char:WaitForChild("Humanoid")
rootPart = char:WaitForChild("HumanoidRootPart")
lastSafeCFrame = rootPart.CFrame
highestY = rootPart.Position.Y
---------------------------------------------------
-- 🔥 HARD RESET (FIX PERMA LOCK BUG)
---------------------------------------------------
teleporting = false
end
if player.Character then setupCharacter(player.Character) end
player.CharacterAdded:Connect(setupCharacter)
---------------------------------------------------
-- GROUND CHECK (UNCHANGED)
---------------------------------------------------
local function isGrounded()
local rayOrigin = rootPart.Position
local rayDirection = Vector3.new(0, -6, 0)
local params = RaycastParams.new()
params.FilterDescendantsInstances = {character}
params.FilterType = Enum.RaycastFilterType.Blacklist
return workspace:Raycast(rayOrigin, rayDirection, params)
end
---------------------------------------------------
-- MAIN
---------------------------------------------------
RunService.RenderStepped:Connect(function()
if not enabled then return end
if not character or not humanoid or not rootPart then return end
---------------------------------------------------
-- 🔥 SAFETY: IF HUMANOID BROKE, FORCE UNLOCK STATE
---------------------------------------------------
if humanoid.Health <= 0 then
teleporting = false
return
end
---------------------------------------------------
-- PREVENT DOUBLE TRIGGERS
---------------------------------------------------
if teleporting then return end
local currentY = rootPart.Position.Y
local state = humanoid:GetState()
---------------------------------------------------
-- SAVE SAFE POSITION
---------------------------------------------------
local groundHit = isGrounded()
if groundHit and state ~= Enum.HumanoidStateType.Freefall then
highestY = currentY
lastSafeCFrame = CFrame.new(
groundHit.Position + Vector3.new(0, 3, 0)
) * CFrame.Angles(
0,
math.rad(rootPart.Orientation.Y),
0
)
end
---------------------------------------------------
-- FALL DETECT
---------------------------------------------------
if state == Enum.HumanoidStateType.Freefall then
local fallenDistance = highestY - currentY
if fallenDistance >= FALL_DISTANCE then
teleporting = true
---------------------------------------------------
-- LOCK
---------------------------------------------------
local oldWalkSpeed = humanoid.WalkSpeed
local oldJumpPower = humanoid.JumpPower
local oldAutoRotate = humanoid.AutoRotate
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
humanoid.AutoRotate = false
rootPart.Anchored = true
---------------------------------------------------
-- TELEPORT
---------------------------------------------------
rootPart.CFrame = lastSafeCFrame
task.wait(LOCK_TIME)
---------------------------------------------------
-- UNLOCK (GUARANTEED)
---------------------------------------------------
rootPart.Anchored = false
humanoid.WalkSpeed = oldWalkSpeed
humanoid.JumpPower = oldJumpPower
humanoid.AutoRotate = oldAutoRotate
highestY = rootPart.Position.Y
task.wait(0.15)
---------------------------------------------------
-- 🔥 CRITICAL RESET (PREVENT STUCK LOOP)
---------------------------------------------------
teleporting = false
end
end
end)No comments yet for this script.



