local Players = game:GetService("Players") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local mouse = player:GetMouse() local playerGui = player:WaitForChild("PlayerGui") -- GUI principal local screenGui = Instance.new("ScreenGui") screenGui.Name = "CameraManagerGUI" screenGui.Parent = playerGui screenGui.ResetOnSpawn = false local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 320, 0, 300) frame.Position = UDim2.new(0, 60, 0, 20) frame.BackgroundColor3 = Color3.fromRGB(35, 35, 35) frame.BorderSizePixel = 0 frame.Parent = screenGui -- Criador de botões local function createTextButton(parent, text, posX, posY, width, height) local btn = Instance.new("TextButton") btn.Size = UDim2.new(0, width, 0, height) btn.Position = UDim2.new(0, posX, 0, posY) btn.Text = text btn.BackgroundColor3 = Color3.fromRGB(50,50,50) btn.TextColor3 = Color3.fromRGB(255,255,255) btn.Parent = parent return btn end -- Botões principais local createButton = createTextButton(frame,"Criar",10,10,80,30) local viewButton = createTextButton(frame,"Ver",100,10,80,30) local deleteButton = createTextButton(frame,"Deletar",190,10,80,30) local firstPersonButton = createTextButton(frame,"Primeira Pessoa",10,45,135,30) local thirdPersonButton = createTextButton(frame,"Terceira Pessoa",155,45,135,30) local teleportButton = createTextButton(frame,"Teleportar",10,80,300,30) -- Botão abrir/fechar GUI local toggleButton = Instance.new("TextButton") toggleButton.Size = UDim2.new(0,40,0,40) toggleButton.Position = UDim2.new(0,10,0,10) toggleButton.BackgroundColor3 = Color3.fromRGB(50,50,50) toggleButton.TextColor3 = Color3.fromRGB(255,255,255) toggleButton.Text = "≡" toggleButton.TextScaled = true toggleButton.Parent = screenGui toggleButton.ZIndex = 1 local guiVisible = true toggleButton.MouseButton1Click:Connect(function() guiVisible = not guiVisible frame.Visible = guiVisible listFrame.Visible = guiVisible arrowPanel.Visible = guiVisible and viewing end) -- Lista de câmeras local listFrame = Instance.new("ScrollingFrame") listFrame.Size = UDim2.new(0,300,0,160) listFrame.Position = UDim2.new(0,10,0,120) listFrame.CanvasSize = UDim2.new(0,0,0,0) listFrame.ScrollBarThickness = 6 listFrame.BackgroundColor3 = Color3.fromRGB(45,45,45) listFrame.Parent = frame local uiListLayout = Instance.new("UIListLayout") uiListLayout.SortOrder = Enum.SortOrder.LayoutOrder uiListLayout.Padding = UDim.new(0,5) uiListLayout.Parent = listFrame -- Painel de setas (giro da câmera) local arrowPanel = Instance.new("Frame") arrowPanel.Size = UDim2.new(0,120,0,120) arrowPanel.Position = UDim2.new(0,10,0,200) -- ajustado para cima arrowPanel.BackgroundColor3 = Color3.fromRGB(40,40,40) arrowPanel.BorderSizePixel = 0 arrowPanel.Visible = false arrowPanel.Parent = frame local rotateSpeed = 0.05 local function addArrow(symbol,x,y) local btn = createTextButton(arrowPanel,symbol,x,y,40,40) return btn end local upArrow = addArrow("▲",40,0) local downArrow = addArrow("▼",40,80) local leftArrow = addArrow("◄",0,40) local rightArrow = addArrow("►",80,40) -- Variáveis principais local cameras = {} local selectedObject = nil local currentCamera = nil local viewing = false local camAngle, camDistance, camHeight = 0,10,5 -- Highlight local highlight = Instance.new("Highlight") highlight.FillColor = Color3.fromRGB(0,255,0) highlight.OutlineColor = Color3.fromRGB(0,255,0) highlight.Enabled = false highlight.Parent = workspace -- Seleção por clique mouse.Button1Down:Connect(function() if mouse.Target then local obj = mouse.Target if obj:IsA("BasePart") then selectedObject = obj.Parent:IsA("Model") and obj.Parent or obj highlight.Adornee = selectedObject highlight.Enabled = true end end end) -- Atualizar lista de câmeras local function updateCameraList() for _,child in pairs(listFrame:GetChildren()) do if child:IsA("TextButton") then child:Destroy() end end for _, cam in ipairs(cameras) do local btn = Instance.new("TextButton") btn.Size = UDim2.new(1,0,0,30) btn.Text = cam.name btn.BackgroundColor3 = (currentCamera==cam.obj) and Color3.fromRGB(0,150,0) or Color3.fromRGB(60,60,60) btn.TextColor3 = Color3.fromRGB(255,255,255) btn.Parent = listFrame btn.MouseButton1Click:Connect(function() currentCamera = cam.obj highlight.Adornee = cam.obj highlight.Enabled = true updateCameraList() end) end listFrame.CanvasSize = UDim2.new(0,0,#cameras*35) end -- Criar câmera createButton.MouseButton1Click:Connect(function() if selectedObject then for _, cam in ipairs(cameras) do if cam.obj == selectedObject then return end end table.insert(cameras,{obj=selectedObject, name=selectedObject.Name, mode="Third"}) currentCamera = selectedObject updateCameraList() end end) -- Atualização da câmera local function updateCameraPosition(camData) if not camData or not camData.obj then return end local camera = workspace.CurrentCamera local primary = (camData.obj:IsA("Model") and (camData.obj.PrimaryPart or camData.obj:FindFirstChildWhichIsA("BasePart"))) or camData.obj if not primary then return end if camData.mode=="First" then camera.CFrame = CFrame.new(primary.Position) * CFrame.Angles(0, camAngle, 0) else camera.CFrame = CFrame.new( primary.Position + Vector3.new(math.sin(camAngle)*camDistance, camHeight, math.cos(camAngle)*camDistance), primary.Position + Vector3.new(0,2,0) ) end end -- Botão Ver viewButton.MouseButton1Click:Connect(function() if currentCamera then viewing = not viewing arrowPanel.Visible = viewing and guiVisible if not viewing then workspace.CurrentCamera.CameraType = Enum.CameraType.Custom camAngle = 0 end end end) -- Botão Deletar deleteButton.MouseButton1Click:Connect(function() if currentCamera then for i, cam in ipairs(cameras) do if cam.obj==currentCamera then table.remove(cameras,i) break end end currentCamera = nil viewing = false arrowPanel.Visible = false highlight.Adornee = nil highlight.Enabled = false workspace.CurrentCamera.CameraType = Enum.CameraType.Custom updateCameraList() end end) -- Primeira / Terceira pessoa firstPersonButton.MouseButton1Click:Connect(function() if currentCamera then for _, cam in ipairs(cameras) do if cam.obj==currentCamera then cam.mode="First" end end end end) thirdPersonButton.MouseButton1Click:Connect(function() if currentCamera then for _, cam in ipairs(cameras) do if cam.obj==currentCamera then cam.mode="Third" end end end end) -- Teleport teleportButton.MouseButton1Click:Connect(function() if currentCamera then local primary = (currentCamera:IsA("Model") and (currentCamera.PrimaryPart or currentCamera:FindFirstChildWhichIsA("BasePart"))) or currentCamera if primary and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then player.Character.HumanoidRootPart.CFrame = primary.CFrame + Vector3.new(0,3,0) end end end) -- Sistema de segurar setas para girar horizontalmente local holdingLeft, holdingRight = false, false local fastRotateSpeed = 0.2 leftArrow.MouseButton1Down:Connect(function() holdingLeft = true end) leftArrow.MouseButton1Up:Connect(function() holdingLeft = false end) rightArrow.MouseButton1Down:Connect(function() holdingRight = true end) rightArrow.MouseButton1Up:Connect(function() holdingRight = false end) -- Atualização contínua da câmera RunService.RenderStepped:Connect(function() if viewing and currentCamera then if holdingLeft then camAngle = camAngle - fastRotateSpeed end if holdingRight then camAngle = camAngle + fastRotateSpeed end for _, cam in ipairs(cameras) do if cam.obj==currentCamera then updateCameraPosition(cam) break end end end end)