Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

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.

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.

2 answers

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.

4 comments

0

Sorry, but the regular first person lock doesn't work while you're in a vehicle seat because the camera gets completely changed.

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...

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.

0

oh...

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.