Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to change camera position to a certain position?

Asked by
R_oven 2
5 years ago

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?

0
did you write this? GoldAngelInDisguise 297 — 5y
0
yah lol starmaq 1290 — 5y
0
turn your CameraType to scriptable. the8bitdude11 358 — 5y
0
plus I swear I saw this script somewhere else the8bitdude11 358 — 5y

Answer this question