Hi everybody,
I am having trouble working with the camera.
I want to lock the camera at first view and when I move (A or D) the player will shoot instead of going sideways.
I went through the camera layer but not got the attributes I needed.
Thanks for all the help
I’ll try my best to help.
- To lock your camera to first person. Go to view → Explorer and properties too. You’ll find this
Select StarterPlayer then see your properties. There you’ll find the properties like shown above. Set CameraMaxZoomDistance to 0.5 and cameraMode to LockFirstPerson. If you want to set it in the middle of your game. Put this code somewhere after your event.
local Camera = game.StarterPlayer
Camera.CameraMaxZoomDistance = 0
Camera.CameraMode = Enum.CameraMode.LockFirstPerson
-
To disable player control. I can’t help much but to link you to this
How to disable player controls with new PlayerScript layout? -
To use A and D to shoot. Insert a LocalScript in StarterPlayer → StarterPlayerScripts. Use this
game:GetService(“UserInputService”).InputEnded:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.D then
if input.KeyCode == Enum.KeyCode.A then
– Put a code here if you press A
else
– Same, but with key D
end
end
end)
For some reason i can’t format it