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

How to Create a 2D Camera?

Asked by 8 years ago

Hello, I am currently developing a ROBLOX Game, and I need assitance on how to change the camera to 2D Locked?

1 answer

Log in to vote
3
Answered by
Hero_ic 502 Moderation Voter
8 years ago

You can use the camera coordinate frame in a localscript inside startergui.

local camera = game.Workspace.CurrentCamera --First we need to get the camera
local player = game:GetService("Players").LocalPlayer --Next the player
local character = player.Character or player.Character:Added() --Make sure we got the character!
--Next we will create a function and name it cameraUpdate!
function cameraUpdate() --next we get the torso!
    local torso = character:WaitForChild("Torso") --Here is the player's torso! we use WaitForChild just in case they die.
    --Now we can set the camera coordinateframe to all torso cframes!
    camera.CoordinateFrame = CFrame.new(torso.CFrame.X + 8 --[[This is the X position change this to what you want.]],torso.CFrame.Y + 2.4 --[[Change 2.4 which is the y value to whatever you like]] ,24 --[[This is the Z value or the distance change it to whatever you like]])
end

game:GetService("RunService").RenderStepped:connect(cameraUpdate) --and last we connect the runservice to the function!

That is it! if this worked your welcome and please accept :D ~KIHeros

2
Please explain your answer. He said he needed HELP, and the fact that this site isn't a request site, and you seem to be encouraging the concept. ChemicalHex 979 — 8y
1
I edited the answer with comments Hero_ic 502 — 8y
Ad

Answer this question