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

Code not changing camera mode from scriptable to custom?

Asked by 8 years ago

Any reason as to why it is not changing the camera mode? I tried both local, and normal scripts.

1player = game.Players.LocalPlayer
2 
3function onTouched(hit)
4player.CameraMode = "Custom"
5end
6script.Parent.Touched:connect(onTouched)

1 answer

Log in to vote
1
Answered by
nilVector 812 Moderation Voter
8 years ago
Edited 8 years ago

What you are trying to do is change a player's CameraMode property to a Camera object's CameraType, which you cannot do.

If you just want a player to have a first-person or third-person view, you would do something like this:

1player.CameraMode = Enum.CameraMode.LockFirstPerson
2player.CameraMode = Enum.CameraMode.Classic

However, seeing how you want to change it to "Custom," you would have to do so by changing the local camera's CameraType like this:

1local player = game.Players.LocalPlayer
2local cam = game.Workspace.CurrentCamera -- The local camera you want
3 
4cam.CameraType = "Custom"

Hope this helps! If it does, don't forget to click "Accept Answer" and/or +1 my Rep!

Ad

Answer this question