Cam GUI
Key RequiredUniversal

Cam GUI

Universal ScriptLow_LVLLow_LVL 882 views 4.1K executesUpdated Sep 8, 2026
0.0/ 5(2 votes)
020% Positive
Lua Script•171 lines (5106 chars)
local UIS = game:GetService("UserInputService")

local screenGUI = Instance.new("ScreenGui")
local player = game.Players.LocalPlayer
screenGUI.Parent = player.PlayerGui
screenGUI.ResetOnSpawn = false

local mindistance = player.CameraMinZoomDistance
	
local maxdistance = player.CameraMaxZoomDistance

local MainFrame = Instance.new("Frame")
MainFrame.Parent = screenGUI
MainFrame.Size = UDim2.new(0, 250, 0, 100)
MainFrame.Position = UDim2.new(0.033, 0, 0.757, 0)


local UICorner = Instance.new("UICorner")
UICorner.Parent = MainFrame
UICorner.CornerRadius = UDim.new(0, 8)

local button = Instance.new("TextButton")
button.Parent = MainFrame
button.Size = UDim2.new(0, 30, 0, 30)
button.Position = UDim2.new(0.028, 0, 0.07, 0)
button.Text = "Cam"
button.TextColor3 = Color3.new(0, 0, 0)
button.BackgroundColor3 = Color3.new(0.27451, 0.27451, 0.27451)
button.TextScaled = true

local UICorner = Instance.new("UICorner")
UICorner.Parent = button
UICorner.CornerRadius = UDim.new(0, 8)

local textbox = Instance.new("TextBox")
textbox.Parent = MainFrame
textbox.Size = UDim2.new(0, 100, 0, 30)
textbox.Position = UDim2.new(0.32, 0, 0.47, 0)
textbox.Text = "camera id here..."
textbox.TextColor3 = Color3.new(0, 0, 0)
textbox.BackgroundColor3 = Color3.new(0.27451, 0.27451, 0.27451)
textbox.TextScaled = true


local keyToCam = {
	[Enum.KeyCode.KeypadOne] = 1,
	[Enum.KeyCode.KeypadTwo] = 2,
	[Enum.KeyCode.KeypadThree] = 3,
	[Enum.KeyCode.KeypadFour] = 4,
	[Enum.KeyCode.KeypadFive] = 5,
	[Enum.UserInputType.MouseButton1] = 0,
	[Enum.UserInputType.MouseButton2] = 6,
}

local currentCam = ""
local function placeCamera()
	local text ,wrongtext = textbox.Text:gsub("%D","")
	local cameraId = tonumber(text)
	if cameraId > 5 then 
		print("id is too high, you dont have that many buttons idiot.")
	else

		local Camera = Instance.new("Part")
		if workspace:FindFirstChild("Camera" .. cameraId) then
			Camera:Destroy()
			local camera2 = workspace:FindFirstChild("Camera" .. cameraId)
			camera2.Position = player.Character.HumanoidRootPart.Position + Vector3.new(0, 5, 0)
		else
			Camera.Name = "Camera" .. cameraId
			Camera.Parent = workspace
			Camera.Anchored = true
			Camera.CanCollide = false
			Camera.Size = Vector3.new(1, 1, 1)
			Camera.Position = player.Character.HumanoidRootPart.Position + Vector3.new(0, 5, 0)
		end
	end
end
local highlight = Instance.new("Highlight")
highlight.Parent = player.Character
highlight.FillTransparency = 1
highlight.OutlineTransparency = 0
highlight.Enabled = false


local function changeCamera(cameraNum)
	print(currentCam == ("Camera" .. cameraNum))
	if currentCam == ("Camera" .. cameraNum) then
		local character = player.Character or player.CharacterAdded:Wait()
		local humanoid = character:WaitForChild("Humanoid")
		
		workspace.CurrentCamera.CameraSubject = humanoid		
		player.CameraMode = Enum.CameraMode.Classic
		
		player.CameraMaxZoomDistance = 5
		player.CameraMinZoomDistance = 5
		task.wait(0.1)
		player.CameraMaxZoomDistance = maxdistance
		player.CameraMinZoomDistance = mindistance
		
		currentCam = ""
		highlight.Enabled = false

	else

		workspace.CurrentCamera.CameraSubject = workspace:FindFirstChild("Camera" .. cameraNum)
		player.CameraMode = Enum.CameraMode.LockFirstPerson
		
		currentCam = "Camera" .. cameraNum
		keyToCam[Enum.UserInputType.MouseButton1] = cameraNum
		
		UIS.MouseBehavior = Enum.MouseBehavior.Default
		highlight.Enabled = true
		print(cameraNum)
		
	end
end

for i = 1, 5 do
	local clone = button:Clone()
	clone.Parent = MainFrame
	clone.Position = UDim2.new(0.028 + ((i - 1) * 0.2), 0, 0.07, 0)
	clone.Text = "Cam " .. i
	clone.Name = "button" .. i
	clone.MouseButton1Click:Connect(function()
		changeCamera(tonumber(clone.Name:gsub("%a", "")))
	end)
end
button:Destroy()

local button6 = Instance.new("TextButton")
button6.Parent = MainFrame
button6.Size = UDim2.new(0, 50, 0, 30)
button6.Position = UDim2.new(0.028, 0, 0.47, 0)
button6.Text = "place cam"
button6.TextColor3 = Color3.new(0, 0, 0)
button6.BackgroundColor3 = Color3.new(0.27451, 0.27451, 0.27451)
button6.MouseButton1Click:Connect(function()
	placeCamera()
end)

local UICorner = Instance.new("UICorner")
UICorner.Parent = button6
UICorner.CornerRadius = UDim.new(0, 8)



local flipandflop = true
UIS.InputBegan:Connect(function(input, gameProcessed)
	-- Ignore inputs if the player is typing in your text box
	if gameProcessed then return end 

	-- Check if the pressed key matches one of our camera numbers
	local cameraNum = keyToCam[input.KeyCode]
	if cameraNum then
		changeCamera(cameraNum)
	end
	if input.KeyCode == Enum.KeyCode.KeypadSix or input.UserInputType == Enum.UserInputType.MouseButton2 and currentCam ~= "" then
		if flipandflop then
			workspace.CurrentCamera.FieldOfView = 10
			UIS.MouseDeltaSensitivity = 0.1428571428571429
			flipandflop = false
		else
			workspace.CurrentCamera.FieldOfView = 70
			UIS.MouseDeltaSensitivity = 1
			flipandflop = true
		end
	end
	if input.UserInputType == Enum.UserInputType.MouseButton1 and currentCam ~= "" then
		changeCamera(keyToCam[Enum.UserInputType.MouseButton1])
	end
end)

Features & Information

: | : | : | : | : | : | : | : | : | : | : | : | : | : | DISCLAIMER! : this was debugged using gen ai, and before you boo me i have my reasons its also pretty useless, i recommend using InfiniteYield to just get the job done. : | : | : | : | : | : | : | : | : | : | : | : | : | : | /\/\/\/\/\/\/\/\/\/\ HOW TO USE: numpad 1-5 is the corresponding camera, numpad 6 is zoom GUI, you press the camera buttons to access the camera, left mouse exit camera, right mouse zoom. placing cameras is via the GUI always, input the cam id (1 - 5) in the text box and press place cam /\/\/\/\/\/\/\/\/\/\ it allows you to place up to 5 cameras that you can switch through via the gui and mouse, or via numpad. should work on mobile too but idfk im not risking downloading an executor on my phone. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : why i used gen ai: im fucking stupid, i once during the making process inputed an integer into a function that required an instance, and i didnt even use that piece of code. and i probably wouldnt even notice for a long time if i didnt beg gemini to fix it. also it was just a spontanious idea and i just wanted to get over it and im an amateur at coding. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts