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

How do I set CurrentCamera's position and where it is pointing to?

Asked by 4 years ago

My system is set up so upon receiving a remote event, the local script will run the following code:

game.ReplicatedStorage.RemoteEvent2.OnClientEvent:Connect(function()
    print("This function has been received.")
    local CurrentCamera = game.Workspace.CurrentCamera
    CurrentCamera.CameraType = Enum.CameraType.Scriptable
    CurrentCamera.CFrame = CFrame.new(game.Workspace.End.Position, game.Workspace:WaitForChild("Ridley").HumanoidRootPart.Position)
end)

"End" is the part in workspace that I want the CurrentCamera to be positioned at, and "Ridley" is an NPC in workspace that I want the CurrentCamera to be pointing towards. The script is receiving the remote event, but the player's camera (while testing in Studio) has not changed positions, and there have been no errors.

It's my first time manipulating the camera, and I'm at a loss as to how to fix this.

1 answer

Log in to vote
0
Answered by 4 years ago

Never mind, I figured it out. The local script I was using had to be located in StarterPlayerScripts and had to be named "CameraScript" for it to successfully override the default camera scripts.

Ad

Answer this question