Camera is not fixed on part is should be

  1. What do you want to achieve? I want on fix the camera on A part.

  2. What is the issue? My camera is not focused on the part. I have changed the camera type to fixed(in properties) and put the part there but the camera is easily rotatable.

  3. What solutions have you tried so far? I have looked on the dev hub and dev forum plus exterior sources in order to find an issue.
    This involved using scripts and properties to change the result.


local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera

repeat wait()
    Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraPart.CFrame

This is one of the scripts I used but it did not work.
It was local inside starter player scripts.

What you need to do is change the cframe so camera = workspace.Camera
camera.CFrame = (the part).CFrame

1 Like

Put this in a local script and it should work

local player = game.Players.LocalPlayer

repeat wait() until player.Character

local Camera = game.Workspace.CurrentCamera

local camerapart = game.Workspace.Part --- Change this to the part you want

Camera.CameraType = "Scriptable"
Camera.CFrame = camerapart.CFrame
2 Likes

@Zombiefin said it (character limit)

2 Likes

Then when you want it back to normal Camera.CameraType = Enum.CameraType.Custom

2 Likes

This is great!
The result was not completly what I expected(probably due to the parts orientation)
But it worked! And I can work with it.
:grin:

2 Likes

I was not planning on changing it back but what you have suggested just opened up some new possibilities.
Thank You!
:grin:

To change rotation use of the camera do after part.CFrame * CFrame.Angles(0, math.rad(the amount to rotate like 180), 0)

And to move it more forward or back do the next line camera.CFrame = camera.CFrame + vector3.new(and the added position)

1 Like