New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

How can I lock first person while sitting in a vehicle seat?

Asked by 5 years ago

This is my fourth time trying, and every time this has been marked as a duplicate for a question which has nothing to do with vehicle seats.

I already have a fully working first person lock, but vehicle seats disable it while you're sat in one. How can I get around this?

And don't link me to this, it has nothing to do with what I want: https://scriptinghelpers.org/questions/190/the-following-first-person-only-script-does-not-work-solved

0
Ahh, I thought you were talking about a normal seat prior to this question, in which I went and tested and found that false. Sorry about that. Everesty 996 — 5y
0
Ah well, it's OK, you're not the only one to mark the posts as a duplicate. At least this one got through. SuperSamioWorld 20 — 5y

2 answers

Log in to vote
-1
Answered by 5 years ago

What you need to do is create a script in the seat and put this code:

function onTouch(part)
    if part.Parent:findFirstChild("Humanoid") ~= nil then
        script["LocalScript1"].Disabled = false
    end
    if script.Parent:findFirstChild("SeatWeld") == nil then
        script["LocalScript2"].Disabled = false
    end
end

script.Parent.Touched:connect(onTouch)  

Notice I have it find a localscript inside of the script. Make a localscript and name it "LocalScript1". You need to do that. Paste this into the LocalScript:

plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent.Name)
cam = game.Workspace.CurrentCamera
cam.CameraType = "Custom"
plr.CameraMode = Enum.CameraMode.LockFirstPerson

script.Disabled = true

Since I have the script in the seat find a second localscript, make a second localscript into the main script and name it LocalScript2. It should look like this:

--[[
Seat
    Script
        LocalScript1
        LocalScript2
--]]

Have this code in LocalScript2:

plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent.Name)
cam = game.Workspace.CurrentCamera
cam.CameraType = "Custom"
plr.CameraMode = Enum.CameraMode.Classic

script.Disabled = true

It's a bit lengthy and not the best way to do it, but this will work.

Ad
Log in to vote
-2
Answered by 5 years ago

am no good scripter but try this code

while.invehicleseat = true do
lockfirstpersoncamera = true

am really sry if anything goes wrong but try this, this should do the trick, again, only trying to be helpeful.

0
Sorry, but the regular first person lock doesn't work while you're in a vehicle seat because the camera gets completely changed. SuperSamioWorld 20 — 5y
0
then try add a script, that wen u are touching the vehicleseat, it makes a camera, Attached, field of view: lowest possible... u know wat I mean... but sry for disrupting... just trying to be useful and helpful... LokHsuLi 0 — 5y
0
Just been messing around in Play Solo, changed the camera subject to my Head (while sat in a vehicle seat) and re-running the script that activates the first person lock (on any camera type) didn't work. SuperSamioWorld 20 — 5y
0
oh... LokHsuLi 0 — 5y

Answer this question