How to change camera position to a certain position?
local Mouse = game.Players.LocalPlayer:GetMouse() local Camera = game.Workspace.CurrentCamera local DefaultCFrame = Camera.CFrame local Scale = 200 function Update() local Center = Vector2.new(Camera.ViewportSize.X/2, Camera.ViewportSize.Y/2) local MoveVector = Vector3.new((Mouse.X-Center.X)/Scale, (Mouse.Y-Center.Y)/Scale, 0) Camera.CFrame = DefaultCFrame * CFrame.new(DefaultCFrame.p + MoveVector) end game:GetService("RunService").RenderStepped:Connect(Update)
If I run this script, the camera shows in random spot. So, how do I change camera position to a certain position?