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.

player = game.Players.LocalPlayer

function onTouched(hit) 
player.CameraMode = "Custom"
end
script.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:

player.CameraMode = Enum.CameraMode.LockFirstPerson
player.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:

local player = game.Players.LocalPlayer
local cam = game.Workspace.CurrentCamera -- The local camera you want

cam.CameraType = "Custom"

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

Ad

Answer this question