Universal camlock with player list by leososupercool UPDATED
Key RequiredUniversal

Universal camlock with player list by leososupercool UPDATED

Universal ScriptLeandroGjoka4LeandroGjoka4 481 views 6.3K executesUpdated Aug 23, 2026
Unrated
00
Lua Script•1093 lines (17601 chars)
--[[
	WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk!
]]
-- DA UPHILL CAMLOCK
-- LocalScript
-- StarterPlayer > StarterPlayerScripts

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera

--------------------------------------------------
-- SETTINGS
--------------------------------------------------

local CamlockEnabled = false
local AutoAirEnabled = false
local LastTargetJumpState = false

-- Manual target selected from the menu.
-- nil = automatic camera targeting.
local ManualTarget = nil

-- The player currently being camlocked.
local CurrentTarget = nil

local Highlight = nil
local MenuOpen = true
local ButtonsLocked = false

--------------------------------------------------
-- GUI
--------------------------------------------------

local Gui = Instance.new("ScreenGui")
Gui.Name = "DaUphillCamlock"
Gui.ResetOnSpawn = false
Gui.Parent = LocalPlayer:WaitForChild("PlayerGui")

--------------------------------------------------
-- TARGET LABEL
--------------------------------------------------

local TargetLabel = Instance.new("TextLabel")
TargetLabel.Name = "TargetLabel"
TargetLabel.Size = UDim2.new(0, 300, 0, 42)
TargetLabel.Position = UDim2.new(0.5, -150, 0, 20)

TargetLabel.BackgroundColor3 =
	Color3.fromRGB(25, 25, 25)

TargetLabel.BackgroundTransparency = 0.1

TargetLabel.Text =
	"Camlocking: Nobody"

TargetLabel.TextColor3 =
	Color3.new(1, 1, 1)

TargetLabel.TextSize = 17
TargetLabel.Font = Enum.Font.GothamBold

TargetLabel.Parent = Gui

Instance.new("UICorner", TargetLabel).CornerRadius =
	UDim.new(0, 10)

--------------------------------------------------
-- CAMLOCK BUTTON
--------------------------------------------------

local CamlockButton = Instance.new("TextButton")

CamlockButton.Name = "CamlockButton"

CamlockButton.Size =
	UDim2.new(0, 155, 0, 50)

CamlockButton.Position =
	UDim2.new(1, -175, 1, -75)

CamlockButton.BackgroundColor3 =
	Color3.fromRGB(180, 50, 50)

CamlockButton.Text =
	"CAMLOCK: OFF"

CamlockButton.TextColor3 =
	Color3.new(1, 1, 1)

CamlockButton.TextSize = 15
CamlockButton.Font = Enum.Font.GothamBold

CamlockButton.Parent = Gui

Instance.new("UICorner", CamlockButton).CornerRadius =
	UDim.new(0, 12)

--------------------------------------------------
-- AUTO AIR BUTTON
--------------------------------------------------

local AutoAirButton = Instance.new("TextButton")

AutoAirButton.Name = "AutoAirButton"

AutoAirButton.Size =
	UDim2.new(0, 155, 0, 50)

AutoAirButton.Position =
	UDim2.new(1, -175, 1, -135)

AutoAirButton.BackgroundColor3 =
	Color3.fromRGB(180, 50, 50)

AutoAirButton.Text =
	"AUTO AIR: OFF"

AutoAirButton.TextColor3 =
	Color3.new(1, 1, 1)

AutoAirButton.TextSize = 15
AutoAirButton.Font = Enum.Font.GothamBold

AutoAirButton.Parent = Gui

Instance.new("UICorner", AutoAirButton).CornerRadius =
	UDim.new(0, 12)

--------------------------------------------------
-- BUTTON LOCK
--------------------------------------------------

local LockButton = Instance.new("TextButton")

LockButton.Name = "LockButton"

LockButton.Size =
	UDim2.new(0, 155, 0, 45)

LockButton.Position =
	UDim2.new(1, -175, 1, -190)

LockButton.BackgroundColor3 =
	Color3.fromRGB(60, 60, 60)

LockButton.Text =
	"BUTTONS: UNLOCKED"

LockButton.TextColor3 =
	Color3.new(1, 1, 1)

LockButton.TextSize = 14
LockButton.Font = Enum.Font.GothamBold

LockButton.Parent = Gui

Instance.new("UICorner", LockButton).CornerRadius =
	UDim.new(0, 12)

--------------------------------------------------
-- PLAYER MENU
--------------------------------------------------

local PlayerMenu = Instance.new("Frame")

PlayerMenu.Name = "PlayerMenu"

PlayerMenu.Size =
	UDim2.new(0, 270, 0, 350)

PlayerMenu.Position =
	UDim2.new(0, 20, 0.5, -175)

PlayerMenu.BackgroundColor3 =
	Color3.fromRGB(25, 25, 25)

PlayerMenu.BorderSizePixel = 0

PlayerMenu.Parent = Gui

Instance.new("UICorner", PlayerMenu).CornerRadius =
	UDim.new(0, 12)

--------------------------------------------------
-- TITLE
--------------------------------------------------

local Title = Instance.new("TextLabel")

Title.Size =
	UDim2.new(1, -50, 0, 42)

Title.Position =
	UDim2.new(0, 10, 0, 0)

Title.BackgroundTransparency = 1

Title.Text =
	"PLAYER CAMLOCK"

Title.TextColor3 =
	Color3.new(1, 1, 1)

Title.TextSize = 17
Title.Font = Enum.Font.GothamBold

Title.TextXAlignment =
	Enum.TextXAlignment.Left

Title.Parent = PlayerMenu

--------------------------------------------------
-- TOP ARROW
--------------------------------------------------

local TopArrow = Instance.new("TextButton")

TopArrow.Name = "TopArrow"

TopArrow.Size =
	UDim2.new(0, 40, 0, 40)

TopArrow.Position =
	UDim2.new(1, -45, 0, 2)

TopArrow.BackgroundTransparency = 1

TopArrow.Text = "▼"

TopArrow.TextColor3 =
	Color3.new(1, 1, 1)

TopArrow.TextSize = 22
TopArrow.Font = Enum.Font.GothamBold

TopArrow.Parent = PlayerMenu

--------------------------------------------------
-- SEARCH BOX
--------------------------------------------------

local SearchBox = Instance.new("TextBox")

SearchBox.Name = "SearchBox"

SearchBox.Size =
	UDim2.new(1, -20, 0, 38)

SearchBox.Position =
	UDim2.new(0, 10, 0, 48)

SearchBox.BackgroundColor3 =
	Color3.fromRGB(45, 45, 45)

SearchBox.PlaceholderText =
	"Search username..."

SearchBox.PlaceholderColor3 =
	Color3.fromRGB(170, 170, 170)

SearchBox.Text = ""

SearchBox.TextColor3 =
	Color3.new(1, 1, 1)

SearchBox.TextSize = 14
SearchBox.Font = Enum.Font.Gotham

SearchBox.ClearTextOnFocus = false

SearchBox.Parent = PlayerMenu

Instance.new("UICorner", SearchBox).CornerRadius =
	UDim.new(0, 8)

--------------------------------------------------
-- PLAYER LIST
--------------------------------------------------

local PlayerList = Instance.new("ScrollingFrame")

PlayerList.Name = "PlayerList"

PlayerList.Size =
	UDim2.new(1, -20, 1, -105)

PlayerList.Position =
	UDim2.new(0, 10, 0, 95)

PlayerList.BackgroundTransparency = 1

PlayerList.BorderSizePixel = 0

PlayerList.ScrollBarThickness = 5

PlayerList.Parent = PlayerMenu

local Layout = Instance.new("UIListLayout")

Layout.Padding =
	UDim.new(0, 6)

Layout.Parent = PlayerList

--------------------------------------------------
-- BOTTOM ARROW
--------------------------------------------------

local BottomArrow = Instance.new("TextButton")

BottomArrow.Name = "BottomArrow"

BottomArrow.Size =
	UDim2.new(1, 0, 0, 35)

BottomArrow.Position =
	UDim2.new(0, 0, 1, -35)

BottomArrow.BackgroundTransparency = 1

BottomArrow.Text = "▲"

BottomArrow.TextColor3 =
	Color3.new(1, 1, 1)

BottomArrow.TextSize = 20
BottomArrow.Font = Enum.Font.GothamBold

BottomArrow.Parent = PlayerMenu

--------------------------------------------------
-- HIGHLIGHT
--------------------------------------------------

local function RemoveHighlight()

	if Highlight then

		Highlight:Destroy()

		Highlight = nil

	end

end

local function HighlightPlayer(Player)

	RemoveHighlight()

	if not Player then
		return
	end

	if not Player.Character then
		return
	end

	Highlight = Instance.new("Highlight")

	Highlight.Name =
		"CurrentCamlockTarget"

	Highlight.Adornee =
		Player.Character

	Highlight.FillTransparency = 1

	Highlight.OutlineTransparency = 0

	Highlight.OutlineColor =
		Color3.fromRGB(255, 255, 255)

	Highlight.Parent =
		Player.Character

end

--------------------------------------------------
-- UPDATE CURRENT TARGET
--------------------------------------------------

local function UpdateTarget(Player)

	if CurrentTarget == Player then
		return
	end

	-- Remove old player's highlight FIRST.
	RemoveHighlight()

	CurrentTarget = Player

	if Player then

		TargetLabel.Text =
			"Camlocking: " ..
			Player.DisplayName

		HighlightPlayer(Player)

	else

		TargetLabel.Text =
			"Camlocking: Nobody"

	end

end

--------------------------------------------------
-- CLOSEST TO CAMERA
--------------------------------------------------

local function GetClosestToCamera()

	local ClosestPlayer = nil
	local ClosestDistance = math.huge

	local Viewport =
		Camera.ViewportSize

	local CameraCenter =
		Vector2.new(
			Viewport.X / 2,
			Viewport.Y / 2
		)

	for _, Player in ipairs(
		Players:GetPlayers()
	) do

		if Player ~= LocalPlayer then

			local Character =
				Player.Character

			if Character then

				local Humanoid =
					Character:FindFirstChildOfClass(
						"Humanoid"
					)

				local Root =
					Character:FindFirstChild(
						"HumanoidRootPart"
					)

				if Humanoid
					and Root
					and Humanoid.Health > 0 then

					local ScreenPosition, OnScreen =
						Camera:WorldToViewportPoint(
							Root.Position
						)

					if OnScreen then

						local Point =
							Vector2.new(
								ScreenPosition.X,
								ScreenPosition.Y
							)

						local Distance =
							(
								Point -
								CameraCenter
							).Magnitude

						if Distance <
							ClosestDistance then

							ClosestDistance =
								Distance

							ClosestPlayer =
								Player

						end

					end

				end

			end

		end

	end

	return ClosestPlayer

end

--------------------------------------------------
-- REFRESH PLAYER LIST
--------------------------------------------------

local function RefreshPlayers()

	for _, Child in ipairs(
		PlayerList:GetChildren()
	) do

		if Child:IsA("TextButton") then
			Child:Destroy()
		end

	end

	local Search =
		string.lower(
			SearchBox.Text
		)

	for _, Player in ipairs(
		Players:GetPlayers()
	) do

		if Player ~= LocalPlayer then

			local Username =
				string.lower(
					Player.Name
				)

			local DisplayName =
				string.lower(
					Player.DisplayName
				)

			local Matches =
				Search == ""
				or string.find(
					Username,
					Search,
					1,
					true
				)
				or string.find(
					DisplayName,
					Search,
					1,
					true
				)

			if Matches then

				local Button =
					Instance.new(
						"TextButton"
					)

				Button.Size =
					UDim2.new(
						1,
						-5,
						0,
						42
					)

				Button.BackgroundColor3 =
					Color3.fromRGB(
						50,
						50,
						50
					)

				Button.TextColor3 =
					Color3.new(
						1,
						1,
						1
					)

				Button.Text =
					Player.DisplayName ..
					"  @" ..
					Player.Name

				Button.TextSize = 14
				Button.Font =
					Enum.Font.Gotham

				Button.Parent =
					PlayerList

				Instance.new(
					"UICorner",
					Button
				).CornerRadius =
					UDim.new(0, 8)

				Button.Activated:Connect(
					function()

						-- Manual selection.
						ManualTarget =
							Player

						UpdateTarget(
							Player
						)

					end
				)

			end

		end

	end

	PlayerList.CanvasSize =
		UDim2.new(
			0,
			0,
			0,
			Layout.AbsoluteContentSize.Y + 10
		)

end

SearchBox:GetPropertyChangedSignal(
	"Text"
):Connect(
	RefreshPlayers
)

Players.PlayerAdded:Connect(
	RefreshPlayers
)

Players.PlayerRemoving:Connect(
	function(Player)

		if ManualTarget ==
			Player then

			ManualTarget = nil

		end

		if CurrentTarget ==
			Player then

			UpdateTarget(nil)

		end

		RefreshPlayers()

	end
)

RefreshPlayers()

--------------------------------------------------
-- MENU OPEN
--------------------------------------------------

local function OpenMenu()

	MenuOpen = true

	PlayerMenu.Size =
		UDim2.new(
			0,
			270,
			0,
			350
		)

	SearchBox.Visible = true
	PlayerList.Visible = true
	BottomArrow.Visible = true

	TopArrow.Text = "▼"

end

--------------------------------------------------
-- MENU CLOSE
--------------------------------------------------

local function CloseMenu()

	MenuOpen = false

	PlayerMenu.Size =
		UDim2.new(
			0,
			270,
			0,
			50
		)

	SearchBox.Visible = false
	PlayerList.Visible = false
	BottomArrow.Visible = false

	TopArrow.Text = "▲"

end

--------------------------------------------------
-- ARROWS
--------------------------------------------------

TopArrow.Activated:Connect(
	function()

		if MenuOpen then
			CloseMenu()
		else
			OpenMenu()
		end

	end
)

BottomArrow.Activated:Connect(
	CloseMenu
)

--------------------------------------------------
-- CAMLOCK TOGGLE
--------------------------------------------------

CamlockButton.Activated:Connect(
	function()

		CamlockEnabled =
			not CamlockEnabled

		if CamlockEnabled then

			CamlockButton.Text =
				"CAMLOCK: ON"

			CamlockButton.BackgroundColor3 =
				Color3.fromRGB(
					50,
					180,
					80
				)

		else

			CamlockButton.Text =
				"CAMLOCK: OFF"

			CamlockButton.BackgroundColor3 =
				Color3.fromRGB(
					180,
					50,
					50
				)

			-- Remove highlight when disabled.
			UpdateTarget(nil)

		end

	end
)

--------------------------------------------------
-- AUTO AIR TOGGLE
--------------------------------------------------

AutoAirButton.Activated:Connect(
	function()

		AutoAirEnabled =
			not AutoAirEnabled

		if AutoAirEnabled then

			AutoAirButton.Text =
				"AUTO AIR: ON"

			AutoAirButton.BackgroundColor3 =
				Color3.fromRGB(
					50,
					180,
					80
				)

		else

			AutoAirButton.Text =
				"AUTO AIR: OFF"

			AutoAirButton.BackgroundColor3 =
				Color3.fromRGB(
					180,
					50,
					50
				)

			LastTargetJumpState = false

		end

	end
)

--------------------------------------------------
-- BUTTON LOCK TOGGLE
--------------------------------------------------

LockButton.Activated:Connect(
	function()

		ButtonsLocked = not ButtonsLocked

		if ButtonsLocked then

			LockButton.Text =
				"BUTTONS: LOCKED"

			LockButton.BackgroundColor3 =
				Color3.fromRGB(
					180,
					50,
					50
				)

		else

			LockButton.Text =
				"BUTTONS: UNLOCKED"

			LockButton.BackgroundColor3 =
				Color3.fromRGB(
					60,
					60,
					60
				)

		end

	end
)

--------------------------------------------------
-- MAIN CAMLOCK LOOP
--------------------------------------------------

RunService.RenderStepped:Connect(
	function()

		if not CamlockEnabled then
			return
		end

		--------------------------------------------------
		-- MANUAL TARGET
		--------------------------------------------------

		if ManualTarget then

			if not ManualTarget.Parent then

				ManualTarget = nil

				UpdateTarget(nil)

			else

				UpdateTarget(
					ManualTarget
				)

			end

		--------------------------------------------------
		-- AUTOMATIC TARGET
		--------------------------------------------------

		else

			local AutomaticTarget =
				GetClosestToCamera()

			UpdateTarget(
				AutomaticTarget
			)

		end

		--------------------------------------------------
		-- CAMERA
		--------------------------------------------------

		if not CurrentTarget then
			return
		end

		if not CurrentTarget.Character then

			UpdateTarget(nil)

			return

		end

		local Root =
			CurrentTarget.Character:
			FindFirstChild(
				"HumanoidRootPart"
			)

		if not Root then
			return
		end

		--------------------------------------------------
		-- AUTO AIR
		--------------------------------------------------

		if AutoAirEnabled then

			local Humanoid =
				CurrentTarget.Character:
				FindFirstChildOfClass("Humanoid")

			if Humanoid then

				local IsJumping =
					Humanoid:GetState() ==
					Enum.HumanoidStateType.Jumping
					or
					Humanoid:GetState() ==
					Enum.HumanoidStateType.Freefall

				if IsJumping and not LastTargetJumpState then
					mouse1click()
				end

				LastTargetJumpState = IsJumping

			end

		else

			LastTargetJumpState = false

		end

		Camera.CFrame =
			CFrame.lookAt(
				Camera.CFrame.Position,
				Root.Position
			)

	end
)

--------------------------------------------------
-- DRAGGING
--------------------------------------------------

local function MakeDraggable(Object, CanLock)

	local Dragging = false
	local DragStart
	local StartPosition

	Object.InputBegan:Connect(
		function(Input)

			if CanLock and ButtonsLocked then
				return
			end

			if Input.UserInputType ==
				Enum.UserInputType.MouseButton1
				or
				Input.UserInputType ==
				Enum.UserInputType.Touch then

				Dragging = true

				DragStart =
					Input.Position

				StartPosition =
					Object.Position

			end

		end
	)

	UserInputService.InputChanged:Connect(
		function(Input)

			if not Dragging then
				return
			end

			if CanLock and ButtonsLocked then
				Dragging = false
				return
			end

			if Input.UserInputType ==
				Enum.UserInputType.MouseMovement
				or
				Input.UserInputType ==
				Enum.UserInputType.Touch then

				local Delta =
					Input.Position -
					DragStart

				Object.Position =
					UDim2.new(
						StartPosition.X.Scale,
						StartPosition.X.Offset +
							Delta.X,

						StartPosition.Y.Scale,
						StartPosition.Y.Offset +
							Delta.Y
					)

			end

		end
	)

	UserInputService.InputEnded:Connect(
		function(Input)

			if Input.UserInputType ==
				Enum.UserInputType.MouseButton1
				or
				Input.UserInputType ==
				Enum.UserInputType.Touch then

				Dragging = false

			end

		end
	)

end

--------------------------------------------------
-- MAKE UI MOVABLE
--------------------------------------------------

MakeDraggable(PlayerMenu, false)
MakeDraggable(CamlockButton, true)
MakeDraggable(AutoAirButton, true)

--------------------------------------------------
-- RE-HIGHLIGHT AFTER RESPAWN
--------------------------------------------------

Players.PlayerAdded:Connect(
	function(Player)

		Player.CharacterAdded:Connect(
			function()

				task.wait(0.2)

				if CurrentTarget ==
					Player then

					HighlightPlayer(
						Player
					)

				end

			end
		)

	end
)

Features & Information

Camlock with a player list for shooting games
#camlock#universal#Aimbot#Auto air#Lock

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts