Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

CameraFocus help please?

I have a part in workspace called"FocusHere" and when game starts the camera will focus and spin around the brick. I want to take out that brick and when a player joins, it will focus on the player.

So instead of a part, I want the player to be focused on.

player = game.Players.LocalPlayer
cam =  game.Workspace.CurrentCamera

cam.CameraSubject = game.Workspace.FocusHere
cam.CameraType = "Custom"

loops = 0
angle = 0
position = 0

while loops <500 do
	cam.CoordinateFrame = game.Workspace.FocusHere.CFrame * CFrame.Angles(0,angle,angle) * CFrame.new(position, position, position)
	
	loops = loops + 1
	angle = angle + math.rad(3)
	position = position + 1
	wait()
end



cam.CameraSubject = player.Character.Humanoid

cam.CameraType = "Follow"

script:Destroy()

1 answer

✓ Accepted answer

These are my changes to make this work:

player = game.Players.LocalPlayer
head = player.Character.Head
cam =  game.Workspace.CurrentCamera

cam.CameraSubject = head --game.Workspace.FocusHere
cam.CameraType = "Custom" 

loops = 0
angle = 0
position = 0

while loops <500 do
    cam.CoordinateFrame = cam.CameraSubject.CFrame * CFrame.Angles(0,angle,angle) * CFrame.new(position, position, position)

    loops = loops + 1
    angle = angle + math.rad(3)
    position = position + 1
    wait(.05)
end



cam.CameraSubject = game.Players.LocalPlayer.Character.Humanoid

cam.CameraType = "Custom"

script:Destroy()

1 comment

0

Thanks, it worked.

This discussion is preserved as it was. New answers, comments, and votes are closed.