CameraMode (Property): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Flurite
No edit summary
m Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">"
 
(25 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{CatUp|Properties}}
{{Local}}
{{Local}}
<onlyinclude>{{Property
<onlyinclude>{{Property
|name = CameraMode
|name = CameraMode
|type = CameraMode
|type = [[CameraMode_(Enum)|CameraMode]]
|description = Changes mode of camera - either first/third person or first person only
|description = Changes mode of camera - either first/third person or first person only
|object = Player
|object = Player
Line 10: Line 8:
{{clear floats}}
{{clear floats}}
==Example==
==Example==
This code, put in a {{type|instance=LocalScript}}, would lock the camera of the player it is running for to [[first person|First Person]].
This code, put in a {{type|instance=LocalScript}}, would lock the camera of the player it is running for to [[first person]].
<code lua>
<syntaxhighlight lang="lua">
game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
</code>
</syntaxhighlight>
==Notes==
If you use this property in a {{type|instance=Script}}, it will set the property, but it will not work as expected. The property must be set from a {{type|instance=LocalScript}}.
==See Also==
*[[RBX.lua.Camera (Object)|Camera]]


[[Category:Properties]]
[[Category:Properties]]
== External links ==
*[https://en.wikipedia.org/wiki/First-person_%28video_games%29 Wikipedia: First-person (video games)]

Latest revision as of 05:04, 27 April 2023

Local: This item should be used with a LocalScript in order to work as expected in online mode.
CameraMode
Type CameraMode
Description Changes mode of camera - either first/third person or first person only
Member of Player

Example

This code, put in a LocalScript, would lock the camera of the player it is running for to first person.

game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson

External links