Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

CameraFocus help please?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

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

Log in to vote
1
Answered by 8 years ago

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()
0
Thanks, it worked. FiredDusk 1466 — 8y
Ad

Answer this question