Camera in Vehicles

Hello, I have been trying to make it so players can’t zoom into the first person when in vehicles in my game. As you can see below, my game doesn’t have vehicle interiors so allowing players to zoom into the first person can even be looked at as a glitch.

My goal is to limit the amount that players can zoom in when seated in the drive seat otherwise when they are out, they have free range of motion.

Here is the photo of the vehicle referenced above:

1 Like

1 Like

You can change the CameraMinZoomDistance Player | Roblox Creator Documentation

local players = game:GetService("Players")
local player = players.LocalPlayer or players.PlayerAdded:wait()
local carSeat = workspace.Car.Seat --change this reference

while task.wait() do
	if carSeat.Occupant then --check if seat occupied
		local sitter = players:GetPlayerFromCharacter(carSeat.Occupant.Parent) --get the player that is in the seat
		if sitter.Name == player.Name then --check if player in seat matches local player
			player.CameraMinZoomDistance = 0 --set minimum zoom of local player
		end
	end
end

Local script, place it inside the StarterCharacterScripts folder.

2 Likes