I’m trying to make it so you can only zoom in a certain amount before it preventing you to zoom in any more while in a vehicle Seat.
In other words I’m trying to make it so you can’t enter first person while in a vehicle seat.
I’m also trying to make it only happen in a specific one vehicle seat and not every seat in the game. I’ve looked around for a while now and I’m unable to find any solutions. Can anyone help?
You could use a script inside of the seat of the vehicle that detects when the occupant changes, then set the value if the occupant is a player
WIki links:
https://developer.roblox.com/en-us/api-reference/function/Instance/GetPropertyChangedSignal
Here’s an example script of what the previous reply is referring to.
local players = game:GetService("Players")
local seat = script.Parent
local player
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
local occupant = seat.Occupant
if occupant then
player = players:GetPlayerFromCharacter(occupant.Parent)
if player then
player.CameraMinZoomDistance = 0
end
elseif not occupant then
if player then
player.CameraMinZoomDistance = 0
player = nil
end
end
end)
1 Like