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

how to make it so that when you press "V", your camera view will go first person or vice versa? [closed]

Asked by 6 years ago

aaaaaaaaaaaaaaasfasjfasiofjiowjqiojtiqwitjwqiotqjoigjagss

20 chars

0
There is no effort put into your question, so I will put no effort into answering it for you. T0XN 276 — 6y
0
diz queztion hurtz ;C u hurtz my feelingz ;-; TheeDeathCaster 2368 — 6y
0
To be serious, please put some effort in. We're human too; we're not bots. TheeDeathCaster 2368 — 6y

Closed as Not Constructive by Leamir, theCJarmy7, and TheeDeathCaster

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

For Future Reference: Please at least try to attempt writing the code. A lot of people will rage at you if you don't.

Anyway I took a little time and wrote the following code. It is pretty basic and straightforward.

-- Declaration Section 

local player = game:GetService("Players").LocalPlayer 
local userInputService = game:GetService("UserInputService")
local status = "Third"

-- Processing Section 

userInputService.InputBegan:Connect(function(key, gameProcessedEvent)
    if not gameProcessedEvent then
        if key.KeyCode == Enum.KeyCode.V then
            if status == "Third" then 
                print ("Changing to First Person Mode!")
                player.CameraMode = "LockFirstPerson"
                player.CameraMaxZoomDistance = 0.5
                print ("First Person Mode Initialized!")
                status = "First"
            else 
                print ("Reverting to Third Person Mode!")
                player.CameraMode = "Classic"
                player.CameraMaxZoomDistance = 400
                player.CameraMinZoomDistance = 15
                print ("Third Person Mode Initialized!")
                status = "Third"
            end
        end
    end
end)
If this helped, please flag this as answered. Have a nice evening.
0
People also don't like it when people just request what they want, and have a filler description, with no attempt at trying anything out for themselves at all. theCJarmy7 1293 — 6y
0
^ Yes my guy. Axceed_Xlr 380 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(key,gameProc)
    if not gameProc then
        if key.KeyCode == Enum.KeyCode.V then
            --do code
        end
    end
end)