local UIS = game:GetService("UserInputService") local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera local AimlockEnabled = false local TargetPart = "RightUpperLeg" local playerIndex = 1 local playerList = {} local currentTarget = nil -- Function to update the list of targetable players local function updatePlayerList() playerList = {} for _, player in pairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild(TargetPart) and player.Character.Humanoid.Health > 0 then table.insert(playerList, player) end end end -- Function to get the next player in the list local function getNextPlayer() if #playerList == 0 then return nil end playerIndex = playerIndex % #playerList + 1 return playerList[playerIndex] end -- Aimlock function local function aimlock() if AimlockEnabled then if not currentTarget or not currentTarget.Character or not currentTarget.Character:FindFirstChild(TargetPart) or currentTarget.Character.Humanoid.Health <= 0 then currentTarget = getNextPlayer() end if currentTarget and currentTarget.Character:FindFirstChild(TargetPart) then local aimPart = currentTarget.Character[TargetPart] local offset = Vector3.new(0, 0.5, 0) -- Adjust the offset for smoother transitions Camera.CFrame = CFrame.new(Camera.CFrame.Position, aimPart.Position + offset) end end end -- Function to create the GUI local function createGui() -- Check if GUI already exists if LocalPlayer:FindFirstChild("PlayerGui"):FindFirstChild("AimlockScreenGui") then return end local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "AimlockScreenGui" local AimlockButton = Instance.new("TextButton") ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui") AimlockButton.Size = UDim2.new(0, 100, 0, 50) AimlockButton.Position = UDim2.new(0.5, -50, 0.5, -25) AimlockButton.Text = "aimlock" AimlockButton.TextColor3 = Color3.new(0, 0, 0) AimlockButton.BackgroundColor3 = Color3.new(1, 1, 1) AimlockButton.BackgroundTransparency = 0.5 AimlockButton.Parent = ScreenGui -- Make GUI draggable local dragging local dragStart local startPos AimlockButton.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = AimlockButton.Position end end) AimlockButton.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.Touch and dragging then local delta = input.Position - dragStart AimlockButton.Position = UDim2.new(0, startPos.X.Offset + delta.X, 0, startPos.Y.Offset + delta.Y) end end) AimlockButton.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) -- Chroma Rainbow Effect spawn(function() while true do for hue = 0, 255 do AimlockButton.BackgroundColor3 = Color3.fromHSV(hue / 255, 1, 1) wait(0.01) end end end) -- Toggle Aimlock AimlockButton.MouseButton1Click:Connect(function() AimlockEnabled = not AimlockEnabled if AimlockEnabled then AimlockButton.Text = "aimlock//on" else AimlockButton.Text = "aimlock//off" end end) end -- Update player list periodically spawn(function() while true do updatePlayerList() wait(1) end end) -- Aimlock loop game:GetService("RunService").RenderStepped:Connect(aimlock) -- Create the GUI createGui()