I named a part 'cameraPart'.
I put a LocalScript in the StarterGUI, to make the script appear in the player when they spawn, which it did.
The line of code I entered was:
game.Workspace.CurrentCamera.CameraSubject = game.Workspace.cameraPart
All it does is put the camera where the camera was left off in ROBLOX Studio, instead of attatching the camera to the part.
Can someone help me please?
I looked around in the wiki and put this together to work.
I changed the Camera's CameraType to Scriptable
(so the script has complete control over the camera), then I changed the Camera's CoordinateFrame property(Which is the CFrame
position of the camera) to target.position, then moved it back by 5 units so you can see the part
I used CFrame.Angles()
to change the angle of where it's looking at.(down)
Sorry for the poor explaining here, I don't have much experience with cameras. Read more on cameras here.
The end code should look like this.
local target = workspace.cameraPart local camera = workspace.CurrentCamera camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = target camera.CoordinateFrame = CFrame.new(target.Position)* CFrame.Angles(-180, 0, 0)*CFrame.new(0,0,5)