Make it so that u can still walk and jump and other stuff. ` local Players =…
- User
Make it so that u can still walk and jump and other stuff.
local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("User InputService") -- Configuration local FACE_TRACKING_DISTANCE = 10 -- Distance within which tracking occurs local ROTATION_SPEED = 5 -- Speed of rotation local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoidRootPart = character:WaitForChild("HumanoidRootPart") -- Track the nearest player local function findNearestPlayer() local nearestPlayer = nil local shortestDistance = FACE_TRACKING_DISTANCE for _, otherPlayer in ipairs(Players:GetPlayers()) do if otherPlayer ~= player and otherPlayer.Character then local otherRootPart = otherPlayer.Character:FindFirstChild("HumanoidRootPart") if otherRootPart then local distance = (otherRootPart.Position - humanoidRootPart.Position).Magnitude if distance <= FACE_TRACKING_DISTANCE and distance < shortestDistance then nearestPlayer = otherPlayer shortestDistance = distance end end end end return nearestPlayer end -- Function to make the player face the nearest player local function trackPlayer() local nearestPlayer = findNearestPlayer() if nearestPlayer then local otherRootPart = nearestPlayer.Character.HumanoidRootPart -- Create a look rotation local targetPosition = Vector3.new(otherRootPart.Position.X, humanoidRootPart.Position.Y, otherRootPart.Position.Z) local targetCFrame = CFrame.lookAt(humanoidRootPart.Position, targetPosition) -- Smoothly interpolate rotation humanoidRootPart.CFrame = humanoidRootPart.CFrame:Lerp(targetCFrame, ROTATION_SPEED * RunService.Heartbeat:Wait()) end end -- Connect the tracking function to RunService RunService.Heartbeat:Connect(trackPlayer) - Assistant