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

How to set camera position?

I'm trying to figure out a way to set the players' camera's CFrame position that stays in the same place and doesn't move.

Could anyone help me out

1 comment

0

I'm 100% sure I fixed it this time, I just ran it in my own game

1 answer

✓ Accepted answer

To accomplish this task, you should follow these steps:

1.) Add a remote event named ChangeCamera to ReplicatedStorage 2.) Add a local script into the starter scripts folder 3.) Add a server script into ServerScriptService

The local script will look like this:


game.ReplicatedStorage.ChangeCamera.OnClientEvent:Connect(function()
	wait()
	repeat workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable until workspace.CurrentCamera.CameraType == Enum.CameraType.Scriptable
	workspace.CurrentCamera.CFrame = CFrame.new(workspace.Reference.Position)
end)

The server script will look like this:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		game.ReplicatedStorage.ChangeCamera:FireClient(plr)
	end)
end)

Sorry that the first answer didn't work, I forgot to change the CameraType

-Cmgtotalyawesome

EDIT: This will 100% work this time, I tested it out in my studio. The problem was not adding a wait to the script.

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