local Workspace = game:GetService("Workspace") local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local localPlayer = Players.LocalPlayer local character = localPlayer.Character or localPlayer.CharacterAdded:Wait() local rootPart = character:WaitForChild("HumanoidRootPart") local humanoid = character:WaitForChild("Humanoid") local MAX_TARGET_DISTANCE = 60 local MAX_JUMPS = 2 local currentJumps = 0 local isFlying = false local attachment = Instance.new("Attachment") attachment.Name = "FlightAttachment" attachment.Parent = rootPart local flightVelocity = Instance.new("LinearVelocity") flightVelocity.Name = "FlightVelocity" flightVelocity.Attachment0 = attachment flightVelocity.MaxForce = 0 flightVelocity.VectorVelocity = Vector3.new(0, 0, 0) flightVelocity.Parent = rootPart local function getNearestTarget() local nearestTarget = nil local shortestDistance = MAX_TARGET_DISTANCE for _, player in ipairs(Players:GetPlayers()) do if player ~= localPlayer and player.Character then local targetRoot = player.Character:FindFirstChild("HumanoidRootPart") local targetHumanoid = player.Character:FindFirstChildOfClass("Humanoid") if targetRoot and targetHumanoid and targetHumanoid.Health > 0 then local distance = (rootPart.Position - targetRoot.Position).Magnitude if distance < shortestDistance then shortestDistance = distance nearestTarget = targetRoot end end end end return nearestTarget end local function updateTargetHighlight(targetRoot) for _, obj in ipairs(Workspace:GetChildren()) do local oldHighlight = obj:FindFirstChild("TargetHighlight") if oldHighlight then oldHighlight:Destroy() end end if targetRoot and targetRoot.Parent then local highlight = Instance.new("Highlight") highlight.Name = "TargetHighlight" highlight.FillColor = Color3.fromRGB(255, 0, 0) highlight.FillTransparency = 0.6 highlight.OutlineColor = Color3.fromRGB(255, 255, 255) highlight.OutlineTransparency = 0 highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop highlight.Parent = targetRoot.Parent end end RunService.RenderStepped:Connect(function() local target = getNearestTarget() updateTargetHighlight(target) if target then local targetPosition = Vector3.new(target.Position.X, rootPart.Position.Y, target.Position.Z) rootPart.CFrame = CFrame.lookAt(rootPart.Position, targetPosition) end end) humanoid.StateChanged:Connect(function(_, newState) if newState == Enum.HumanoidStateType.Landed then currentJumps = 0 end end) UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.Space and not isFlying then if currentJumps < MAX_JUMPS then currentJumps = currentJumps + 1 if currentJumps > 1 then rootPart.AssemblyLinearVelocity = Vector3.new(rootPart.AssemblyLinearVelocity.X, 45, rootPart.AssemblyLinearVelocity.Z) end end end if input.KeyCode == Enum.KeyCode.F then isFlying = not isFlying if isFlying then humanoid.PlatformStand = true flightVelocity.MaxForce = 50000 flightVelocity.VectorVelocity = Vector3.new(0, 5, 0) else humanoid.PlatformStand = false flightVelocity.MaxForce = 0 flightVelocity.VectorVelocity = Vector3.new(0, 0, 0) end end end)