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

why wont Camera revert to players head?

Asked by
TickoGrey 116
4 years ago

ok so I was working on a cutscene and the localscript that handles the camera position works mostly fine but whenever the cutscene ends the camera will freeze and not go back to the player

btw the script is named CameraScript because for some reason it won't work any other way'

01local cam = game.Workspace.CurrentCamera
02cam.CameraType = Enum.CameraType.Scriptable
03a = false
04b = 0
05while a == false do
06    if game.Workspace.camveiw1 then
07        cam.CFrame = game.Workspace.camveiw1.CFrame
08        wait()
09        b = b+1
10        print(b)
11        if b == 250 or not game.Workspace.camveiw1 then
12            a = true
13        end    
14    end
15end
View all 21 lines...

it counts to 200, prints "gaming" then it just freezes the camera (and the brick the camera is following flys away)

1 answer

Log in to vote
0
Answered by 4 years ago

Your script isn't in the correct order. You are making sure the player's camera isn't scriptable and then trying to script it. To fix: just rearrange to this:

1char = game.Players.LocalPlayer.Character
2if char then
3    print("gaming")
4    cam.CameraSubject = char.Head
5end
6cam.CameraType = Enum.CameraType.Custom

I hope this answers your question

0
this does not work TickoGrey 116 — 4y
Ad

Answer this question