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

Lock First Person?

Asked by 9 years ago

I've tried many methods,

local plr = game.Players.LocalPlayer
local cam = game.Workspace.CurrentCamera
local chr = nil

chr = character
plr.CameraMode = 1

while false do
wait ()
cam.CameraType = 0
cam.CoordinateFrame = CFrame.new (200,10,0)
cam.Focus = CFrame.new (200,7,500)
cam.FieldOfView = 20
end

and even

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

But the first method makes it glitchy while the second method doesn't work online. Why?

3 answers

Log in to vote
0
Answered by
woodengop 1134 Moderation Voter
9 years ago

Well if your trying to find a Working one for Studio and Online here you go!

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        if plr and char then
            plr.CameraMaxZoomDistance = 0.5
            plr.CameraMinZoomDistance = 0.5
        end
    end)
end)

Make sure you use a Script

0
Enjoy woodengop 1134 — 9y
Ad
Log in to vote
2
Answered by 9 years ago

Not sure why it wouldn't work. BUT you can do a

while wait() do -- Which keeps looping really fast
game.Players.LocalPlayer.CameraType = "LockFirstPerson" --That may not be how it's spelt, But that should work.
end
0
It's still glitchy, though. LennyTheLucario 45 — 9y
0
No need for a while loop. Just put "game.Players.LocalPlayer.CameraType = 'LockFirstPerson'" inside a LocalScript inside StarterGui. Perci1 4988 — 9y
0
That doesn't always work. Roblox gets glitchy and doesnt run the line always. xImmortalChaos 565 — 9y
0
It works, but like the mouse like spazzes out. LennyTheLucario 45 — 9y
0
The mouse moves a little when in first person mode, but there's no way for anyone to fix that. Perci1 4988 — 9y
Log in to vote
0
Answered by 9 years ago

What if you put it in a RenderStepped loop?

game:GetService("RunService").RenderStepped:connect(function() -- Faster then wait()
    game.Players.LocalPlayer.CameraType = "LockFirstPerson" -- Lock Camera
end)

http://wiki.roblox.com/index.php?title=API:Class/RunService/RenderStepped

Answer this question