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

Why isn't this camera script working?[Solved]

Asked by 9 years ago

When the player (re)spawns their camera will focus on "CameraPart" but it isn't doing it at all! Why not? Here is my finished script

wait(0.5)
Workspace.CurrentCamera.CameraSubject = Workspace.CameraFocus1
Workspace.CurrentCamera.CameraType = "Attach"

Thank you!!! --this is a local script

0
What are you trying to achieve? The script above will ONLY make the camera focus on CameraPart (which is what you said it does). Discern 1007 — 9y
0
That is the only thing I want it to do, unfortunately it isn't doing that! yogipanda123 120 — 9y
0
I am pretty sure the error has to do with the PlayerAdded part! yogipanda123 120 — 9y

1 answer

Log in to vote
0
Answered by
Wizzy011 245 Moderation Voter
9 years ago

To change a camera's view, firstly you must use a local script inside of the player as only a local script is able to communicate with a camera. Secondly, you should use CurrentCamera not Camera, that's just a instance which is created every time a player spawns, it's not uniquely controllable. By using a local script, this also means you don't need to use PlayerAdded or CharacterAdded, you can just place a localscript inside the StarterGui or StarterGear. This code should work:

Workspace.CurrentCamera.CameraSubject = Workspace.SpawnPlate1
0
That worked but it focuses on a random space, is there a way to fix that? yogipanda123 120 — 9y
0
Try adding a second brick in the direction you'd like the camera to face, set the Focus of the camera to this brick. Wizzy011 245 — 9y
Ad

Answer this question