
Key RequiredUniversal

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local orbiting = false
local orbitSpeed = 500
local orbitRadius = 3
local orbitConnection
local currentTarget
local humanoidRootPart
local function rainbow()
return Color3.fromHSV((tick() * 0.5) % 1, 1, 1)
end
local function getNearestTarget()
local nearest = nil
local minDist = math.huge
if not humanoidRootPart then return end
for _, p in pairs(Players:GetPlayers()) do
if p ~= player and p.Character and p.Character:FindFirstChild("HumanoidRootPart") then
local dist = (humanoidRootPart.Position - p.Character.HumanoidRootPart.Position).Magnitude
if dist < minDist then
minDist = dist
nearest = p.Character.HumanoidRootPart
end
end
end
return nearest
end
local function toggleOrbit()
orbiting = not orbiting
if orbiting then
currentTarget = getNearestTarget()
if currentTarget then
if orbitConnection then orbitConnection:Disconnect() end
orbitConnection = RunService.RenderStepped:Connect(function()
if not humanoidRootPart or not humanoidRootPart.Parent then return end
if not currentTarget or not currentTarget.Parent then return end
local angle = tick() * orbitSpeed
local offset = Vector3.new(math.cos(angle) * orbitRadius, 0, math.sin(angle) * orbitRadius)
local orbitPos = currentTarget.Position + offset
humanoidRootPart.CFrame = CFrame.lookAt(orbitPos, currentTarget.Position)
local targetHumanoid = currentTarget.Parent:FindFirstChild("Humanoid")
if targetHumanoid then
camera.CameraSubject = targetHumanoid
end
end)
end
else
if orbitConnection then orbitConnection:Disconnect() end
camera.CameraSubject = player.Character and player.Character:FindFirstChild("Humanoid")
end
end
local function onCharacterAdded(char)
humanoidRootPart = char:WaitForChild("HumanoidRootPart")
if not orbiting then
camera.CameraSubject = char:FindFirstChild("Humanoid")
end
end
if player.Character then
onCharacterAdded(player.Character)
end
player.CharacterAdded:Connect(onCharacterAdded)
local function createOrbitGui()
local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
gui.Name = "MobileOrbitGui"
gui.ResetOnSpawn = false
local frame = Instance.new("Frame")
frame.Name = "OrbitFrame"
frame.Size = UDim2.new(0, 200, 0, 100)
frame.Position = UDim2.new(0.5, -100, 0.5, -50)
frame.BackgroundColor3 = Color3.new(1, 1, 1)
frame.AnchorPoint = Vector2.new(0.5, 0.5)
frame.Active = true
frame.Draggable = true
frame.Parent = gui
local uicorner = Instance.new("UICorner", frame)
uicorner.CornerRadius = UDim.new(0, 12)
local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, 0, 0.3, 0)
title.Position = UDim2.new(0, 0, 0, 0)
title.BackgroundTransparency = 1
title.Text = "Orbit Controller"
title.Font = Enum.Font.GothamBold
title.TextScaled = true
title.TextColor3 = Color3.new(1, 1, 1)
title.Parent = frame
local button = Instance.new("TextButton")
button.Size = UDim2.new(0.6, 0, 0.4, 0)
button.Position = UDim2.new(0.2, 0, 0.5, 0)
button.Text = "Orbit"
button.Font = Enum.Font.Gotham
button.TextScaled = true
button.TextColor3 = Color3.new(1, 1, 1)
button.BackgroundColor3 = Color3.fromHSV(0, 1, 1)
button.Parent = frame
local btnCorner = Instance.new("UICorner", button)
btnCorner.CornerRadius = UDim.new(0, 10)
button.MouseButton1Click:Connect(toggleOrbit)
RunService.RenderStepped:Connect(function()
local c = rainbow()
frame.BackgroundColor3 = c
button.BackgroundColor3 = c
end)
end
createOrbitGui()



a good gui silly to