I need help with the roblox camera

Hello developers, i need help ! Does anyone know how to script moving the player mouse with the camera part?

Exemple here :

-Tnks

1 Like

You perhaps can use Mouse.Origin.Position with CFrame.lookAt()
Localscript in StarterGui :

local part = game.Workspace:WaitForChild("Part") -- Change to other part you want to become the camera
local camera = game.Workspace.CurrentCamera
local mouse = game.Players.LocalPlayer:GetMouse()

repeat task.wait() until part or camera or mouse ~= nil

if camera ~= nil then
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part.CFrame
end

local newPos = nil

local multiplier = 0.50

mouse.Move:Connect(function()
	newPos = Vector3.new(mouse.Origin.Position.X * multiplier, mouse.Origin.Position.Y * multiplier, mouse.Origin.Position.Z * multiplier)
	camera.CFrame = CFrame.lookAt(camera.CFrame.Position, newPos)
end)
mouse.Origin.Position * multiplier
1 Like

Also:

RunService.RenderStepped:Connect(function()
	Camera.CFrame = Camera.CFrame:Lerp(CFrame.lookAt(Camera.CFrame.Position, Mouse.Hit.Position), Weight)       
end)
1 Like

Thanks mate!

Final script :smile:

local part = game.Workspace:WaitForChild("Part")
local camera = game.Workspace.CurrentCamera
local mouse = game.Players.LocalPlayer:GetMouse()

local runService = game:GetService("RunService")

repeat task.wait() until part or camera or mouse ~= nil

if camera ~= nil then
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part.CFrame
end

local newPos = nil

local multiplier = 0.005

runService.RenderStepped:Connect(function()
	camera.CFrame = camera.CFrame:Lerp(CFrame.lookAt(camera.CFrame.Position, mouse.Hit.Position), multiplier)       
end)

The result is a slowly rotating 360 camera. Thanks @DasKairo!