local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local LocalPlayer = Players.LocalPlayer local active = false local connection = nil local targetPart = nil local function getPartUnderneath() local character = LocalPlayer.Character if not character then return nil end local rootPart = character:FindFirstChild("HumanoidRootPart") if not rootPart then return nil end local raycastParams = RaycastParams.new() raycastParams.FilterType = Enum.RaycastFilterType.Exclude raycastParams.FilterDescendantsInstances = {character} raycastParams.IgnoreWater = true local raycastResult = game.Workspace:Raycast(rootPart.Position, Vector3.new(0, -20, 0), raycastParams) if raycastResult and raycastResult.Instance and raycastResult.Instance:IsA("BasePart") then return raycastResult.Instance end return nil end local function startLock() targetPart = getPartUnderneath() if not targetPart then print("Failed: No Part found underneath") active = false return end local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait() local rootPart = character:WaitForChild("HumanoidRootPart") local offset = Vector3.new(0, 3.5, 0) connection = RunService.Heartbeat:Connect(function() if active and character and character.Parent and targetPart and targetPart.Parent then local targetPosition = targetPart.Position + offset local currentRotation = rootPart.CFrame - rootPart.CFrame.Position rootPart.CFrame = currentRotation + targetPosition rootPart.AssemblyLinearVelocity = Vector3.zero rootPart.AssemblyAngularVelocity = Vector3.zero else if connection then connection:Disconnect() connection = nil end end end) print("Locked Onto Underneath Part") end local function stopLock() active = false if connection then connection:Disconnect() connection = nil end targetPart = nil print("Unlocked") end UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.Z then active = not active if active then startLock() else stopLock() end end end)