
66.6k Views
139 Executions
Universal Orbit Nearest Player Open Source
Universal Script π
3 years ago
Please login to perform these actions:Does it work?
No reports yetNo reports yet. Tried it? Be the first to say.
Also noticed:
Description
Literally, Orbit anyone you want when you press V
Updates
Script edited: Create script
local players = game:GetService("Players")
local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local targetPlayer = nil
local orbitDistance = 5 -- Orbit Distance
local orbitSpeed = 5 -- Orbit Speed ofc dummy don't touch anything else
local orbitToggleKey = Enum.KeyCode.V -- Change V to whatever key bind you like
local isOrbiting = false
local function getNearestPlayer()
local nearestDistance = math.huge
local nearestPlayer = nil
local localCharacter = players.LocalPlayer.Character
if localCharacter then
local localRootPart = localCharacter:FindFirstChild("HumanoidRootPart")
if localRootPart then
for _, player in pairs(players:GetPlayers()) do
if player ~= players.LocalPlayer then
local character = player.Character
if character and character:FindFirstChild("HumanoidRootPart") then
local distance = (character.HumanoidRootPart.Position - localRootPart.Position).Magnitude
if distance < nearestDistance then
nearestDistance = distance
nearestPlayer = player
end
end
end
end
end
end
return nearestPlayer
end
local function startOrbit()
targetPlayer = getNearestPlayer()
isOrbiting = true
end








press V
how does it works