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

Camera Manipulation not working?

Asked by 9 years ago

Yes, it's a local script.

player.PlayersAdded:connect(function(player) player.CharactersAdded:connect(function(character) player.Script:Clone().Parent = Character:wait() camera = Workspace.CurrentCamera camera.Enum = Scriptable camera.FieldOfView = 1

1
Could you edit your post so that the code is inside a code block? It makes the code easier to read, thanks. Spongocardo 1991 — 9y

2 answers

Log in to vote
1
Answered by 9 years ago
player.PlayersAdded:connect(function(player) 
player.CharactersAdded:connect(function(character)

Should be

game.Players.PlayerAdded:connect(function(player) 
player.CharacterAdded:connect(function(character)
Ad
Log in to vote
-1
Answered by 9 years ago

There are quite a few mistakes in your code, see below.

game.Players.PlayerAdded:connect(function(player) --PlayerAdded fires when a player is added. The event is found in the Players service. A function is made with the variable of player being the player.
    player.CharacterAdded:connect(function(character) --Character added fires when the character is added/respawned. The event is found in the player. A function is made with the variable of character being the player's character.
        local s = player.Script:Clone() --Clones the Script called "Script" inside the player.
        s.Parent = character --Parents the clone to the player's character.
        camera = Workspace.CurrentCamera --Sets the camera variable to the CurrentCamera.
        camera.CameraType = "Scriptable" --Sets the camera type of the camera to scriptable.
        camera.FieldOfView = 1 --Sets the camera's field of view to 1.
    end) --Ends the function of the CharacterAdded event.
end) --Ends the function of the PlayerAdded event.
0
You fail to remember that this code is in a local script, so the player is already loaded, otherwise it obviously would not be running. iaz3 190 — 9y

Answer this question