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

How to make a First Person Script?

Asked by 10 years ago

Now, how do make a script which makes the player fully zoomed in. And to add to that they cannot press 'O' or mouse wheel out of first person. Help?

5 answers

Log in to vote
1
Answered by 10 years ago

Set the camera mode (a property in a Player) to 'LockFirstPerson' whenever the thing is triggered. E.G. if it were a tool, you would put something like this in a Local Script (I'm not sure whether local script makes much of a difference I just couldn't be bothered, L comes before S and you can put 'LocalPlayer')

tool = script.Parent
tool.Equipped:connect(function()
    game.Players.LocalPlayer.CameraMode = "LockFirstPerson"
end)
tool.Unequipped:connect(function()
    game.Players.LocalPlayer.CameraMode = "Classic"
end)

--Or do this if you want the person to be locked in First Person view when they join. In a normal script.

game.Players.PlayerAdded:connect(function(player)
    player.CameraMode = "LockFirstPerson"
end)
Ad
Log in to vote
1
Answered by
Regg12 0
10 years ago

If none of the above didn't work put the following text into a Script and let it be in Workspace.

game.Players.PlayerAdded:connect(function(player) player.CameraMode = Enum.CameraMode.LockFirstPerson end)

Log in to vote
0
Answered by 10 years ago

First we want to do it whenever the Player is "Added" to our game

game.Players.PlayerAdded:connect(function(player)
end)

The above code starts a function for whenever the Player is "Added"

game.Players.PlayerAdded:connect(function(player)
    player.CameraMode = Enum.CameraMode.LockFirstPerson
end)

We have now made the player's CameraMode = Lock First Person

Log in to vote
0
Answered by 7 years ago

This is for a regular script. Here-

while true do
local c = game.Players:GetChildren()
for i = 1, #c do
    if c[i].ClassName == "Player" then
    c[i].CameraMode = "LockFirstPerson"
        end
    end
wait(0.00)
end

Hope that helps!

Log in to vote
-1
Answered by 10 years ago

First, grab yourself a localscript.

player = game.Players.LocalPlayer player.CameraMode = "LockFirstPerson"

0
You don't need a LocalScript to set LockFirstPerson, that would be misleading. duckwit 1404 — 10y

Answer this question