I have a lot of vehicles in my game, and some are very large. I've made a script that limits how far the camera goes, but I want the max camera range to increase when a player is in a vehicle, specifically, when they're sitting in a vehicle seat.
Here's the camera script I have so far (in a localscript):
local player = game.Players.LocalPlayer
player.CameraMaxZoomDistance = 20
player.CameraMinZoomDistance = 0
How can I detect when the LocalPlayer is inside a vehicle seat?
For instance:
local player = game.Players.LocalPlayer
player.CameraMaxZoomDistance = 20
player.CameraMinZoomDistance = 0
while true do
wait()
if insideseat then
player.CameraMaxZoomDistance = 40
else
player.CameraMaxZoomDistance = 20
end
end
--or something like that that detects it
Everything I've found so far works when the player is in ANY seat, not just a vehicle seat, which is not what I want. How can I solve this?
Thanks for your help :)
Edit: I would also like to have a way to get the parent of the seat the player is in to detect the vehicle since they're different sizes and I want the camera to adjust differently for each.

1 comment
Thanks! I guess that should solve both of my problems.