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

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

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

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.

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