Hello! I’m having trouble with a 2D Camera script, in which I’m trying to make a camera similar to Baldi’s Basics, in which the camera is locked on the X axis (up and down), so I’ve decided that I want to rewrite it. But, I’m not sure on how to make it work. Can anyone help?
Are you trying to make a 2D game?
No, I’m trying to make a camera similar to Baldi’s Basics, in which the camera is locked on the X axis (up and down).
Ah I see what you mean. I remember being into baldis basics a couple years ago.
You can use busterbob’s solution in order to lock the camera, then just make the player go in first person Make the camera move only on the X axis - #5 by busterbob64
Do you know where to put the code that’s in the solution?
It should be in a local script under startercharacterscripts
Where in the script exactly?
What I have rn:
local Players = game:GetService("Players").LocalPlayer
local char = script.Parent
local hrp = char:WaitForChild("HumanoidRootPart")
local cam = workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
--folder for camera
local PlayerCamera = Instance.new("Folder")
PlayerCamera.Parent = workspace
PlayerCamera.Name = "PlayerCamera"
--camera
local cameraPart = Instance.new("Part")
cameraPart.Transparency = 1
cameraPart.CanCollide = false
cameraPart.Parent = workspace.PlayerCamera
cameraPart.CFrame = CFrame.new(hrp.Position + Vector3.new(-30,10,0), hrp.Position) -->camera angle
--camera move
local bp = Instance.new("BodyPosition")
bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bp.P = 100000 --> camera speed
bp.Parent = cameraPart
--loop
game:GetService("RunService").RenderStepped:Connect(function()
local newCameraCFrame = CFrame.new(
char.Head.Position - (cam.CFrame.LookVector * Vector3.new(1, 0, 1)),
char.Head.Position -- LookAt
)
cam.CFrame = newCameraCFrame
end)
Edit: nvm it works
Alright. Good luck on your baldis basics game
1 Like