So basically, I’m making a scene where you have to press W and SHIFT and you’re running from something, but make it so that you cannot press A and D (which I had already done) and you are not supposed to move your camera so it would lock when running in first person. How would I do this with only lines of scripts, not while true do
and for i = 1, do
.
In a LocalScript:
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
I already did that and I would want it to be forced and you cannot move your camera while in first person.
I have tried,
game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(c)
while true do
workspace.CurrentCamera.CFrame = c.Head.CFrame
wait()
end
end)
end)
but there is other lines on the bottom that is required for the game.
You can set the CameraType
property for CurrentCamera to Enum.CameraType.Scriptable
. This will make it so you cannot move your Camera. Make sure this is down on the CLIENT side.
local CurrentCamera = workspace.CurrentCamera
-- // Lock First Person \\ --
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
-- // Make camera unmoveable \\ --
CurrentCamera.CameraType = Enum.CameraType.Scriptable
I didn’t get any errors but it wouldn’t put me in first person.
I’m having the same problem.
In Garry’s Mod, when you rotate an object, you hold e. while your holding e, your in first person (your cursor is locked in center of screen) and your camera does not move when your mouse does.
I tried setting the camera cframe to one consistent cframe every frame but when you move your mouse any tool equipped starts glitching. I need it with the tool.