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

Camera Manipulation not working?

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 comment

1

Could you edit your post so that the code is inside a code block? It makes the code easier to read, thanks.

2 answers

player.PlayersAdded:connect(function(player) 
player.CharactersAdded:connect(function(character)

Should be

game.Players.PlayerAdded:connect(function(player) 
player.CharacterAdded:connect(function(character)

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.

1 comment

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.

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