I want to create a 2D camera for a little prototype, i have the basic movement of the character and the scene done. but i don’t know how to make a 2D camera because there isn’t even a 2D camera object.
TweenService = game:GetService("TweenService")
RunService = game:GetService("RunService")
Player = game.Players.LocalPlayer
Camera = workspace.CurrentCamera -- Camera
Character = script.Parent
wait()
Camera.CameraType = Enum.CameraType.Scriptable
Part = Instance.new("Part", workspace) -- Part For Camera
Part.Size = Vector3.new(1,1,1) -- Szie
Part.Name = Player.DisplayName.."'s Camera" -- Name
Part.Locked = true -- Can Click on
Part.Transparency = 1 -- Invisible
Part.CanCollide = false -- can Touch
Part.Anchored = true -- Cant fall
Part.Orientation = Vector3.new(0,0,0) -- Set this to whatever, not sure of the Angle
RunService.RenderStepped:Connect(function()
Part.Position = Character.Head.Position + Vector3.new(0,0,20) -- Sets Position
TweenService:Create(Camera, TweenInfo.new(0.5), {CFrame = Part.CFrame}):Play()
end)
Character.Humanoid.Died:Connect(function()
task.wait(game.Players.RespawnTime - 1)
Part:Destroy()
end)
If you want to create a real 2D camera, you have to.
You have to simulate everything from physics to field of view in GUI and that requires some knowledge about OOP cus it helps a lot in that stuff…