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

How can I check to see if a player's camera is in FirstPerson, and change it to ThirdPerson?

Asked by 9 years ago

Hello again! In one of my scripts that involves Camera Manioulation, I found that if the player is in first person, I can not zoom out of it (Which is needed). So I was wondering if there was a way to check to see if a player is in first person and change it to thirdperson!

I'm not sure how to do that but I can do this!

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") ~= nil then
        if game.Players:GetPlayerFromCharacter(hit.Parent).CameraMode == "LockFirstPerson" then-- I know this isn't right but I don't know how to check if the player is in first person
            game.Players:GetPlayerFromCharacter(hit.Parent).CameraMode = "Classic"-- This won't change to third person but I'm not sure how I can do that!
        end
    end
end)

Thanks!

~Mini

2 answers

Log in to vote
1
Answered by
rexbit 707 Moderation Voter
9 years ago

LockFirstPerson when checking, must be checked usingEnumeration, not Strings.

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") ~= nil then
        if game.Players:GetPlayerFromCharacter(hit.Parent).CameraMode == Enum.CameraMode.LockFirstPerson then
            game.Players:GetPlayerFromCharacter(hit.Parent).CameraMode = "Classic"
        end
    end
end)
0
Okay! That's good to know! Thanks! minikitkat 687 — 9y
Ad
Log in to vote
-2
Answered by 9 years ago

"LockThirdPerson" 5 end 6 end 7 end)

Answer this question