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

How do I make a person view in First Person when they are in a particular place in the workspace?

Asked by 8 years ago

Ok, I am making a FPS game, and when I do this script.....

script.Parent = game.Players
function onPlayerEntered(newPlayer)
if newPlayer.ClassName == "Player" then
newPlayer.CameraMode = "LockFirstPerson"
end
end
game.Players.ChildAdded:connect(onPlayerEntered)

it locks it for everywhere I go.

How do I edit this for when I want it to lock in a particular place in a workspace?

0
Use an if statement to see if the Players position is within certain values, where you want it to lock. Then put and else in that will unlock the camera. You could also reverse the order and define where you want it unlocked and lock it in the else. GoldenPhysics 474 — 8y
0
could you make a script showing how to do this? supercoolboy8804 114 — 8y

1 answer

Log in to vote
0
Answered by
Uroxus 350 Moderation Voter
8 years ago

Theory

What you could do is make an invisible part cover the area you want the player to be first person in and once the player touches it put them into first person. This would be quite simple to do initially until you are wanting to get them out of first person...


Possible Solution

It would be something like this, utilizing the Touched event to change the player's camera.

script.Parent.Touched:connect(function(plr)
    plr.CameraMode = "LockFirstPerson"
end)

Then you'd have to get them out of first person either when they die or have some more invisible parts surrounding the first one, and using the same script except change line three (plr.CameraMode = "LockFirstPerson") to have the player's current camera...


Conclusion

I've not tested the script I've provided so hopefully it works, I don't see any reason why it wouldn't. If it doesn't work, please do tell me and I'll fix it. If you want a better explanation please do ask and if this answered your question please accept it with the button on the right!

Ad

Answer this question