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

How to set camera position?

Asked by
CyDave 42
5 years ago
Edited 5 years ago

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

0
I'm 100% sure I fixed it this time, I just ran it in my own game cmgtotalyawesome 1418 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.

Ad

Answer this question