Hey guys i want to make a script so that when the player zooms the camera out that the proximityprompt disappears, but i can’t get it to work i tried to find scripts which check the players camera zoom but none of them seem to be working. and also the script should only work if the player is sitting in the VehicleSeat, what i want to achieve is that the annoying proximityprompt disappears when you zoom out.
So heres the script:
local ProximityPrompt = game.Workspace.Car.Body.Music.ProximityPrompt
local player = game.Players.LocalPlayer
game:GetService("RunService").RenderStepped:Connect(function()
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
ProximityPrompt.Enabled = true
else
ProximityPrompt.Enabled = false
end
end)
Okay, here’s a script that should work for your scenario:
local ProximityPrompt = game.Workspace.Car.Body.Music.ProximityPrompt
local player = game.Players.LocalPlayer
local function updatePromptVisibility()
if player.SeatPart and player.SeatPart:IsA("VehicleSeat") then
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
ProximityPrompt.Enabled = true
else
ProximityPrompt.Enabled = false
end
else
ProximityPrompt.Enabled = false
end
end
-- Check for changes to camera mode and seat
player:GetPropertyChangedSignal("CameraMode"):Connect(updatePromptVisibility)
player:GetPropertyChangedSignal("SeatPart"):Connect(updatePromptVisibility)
-- Initial check
updatePromptVisibility()
Player.CameraMode never changes when the player zooms in or out. If Player.CameraMode is set to LockFirstPerson the player can’t zoom in or out and stuck in first person, while when set to Classic gives the player the ability to first person or third person by zooming in or out the camera.
Instead, detect if LocalTransparencyModifier of player’s head changes. If it’s 1, it means the player is in first person.
local ProximityPrompt = game.Workspace.Car.Body.Music.ProximityPrompt
local player = game.Players.LocalPlayer
local character = if player.Character and player.Character.Parent then player.Character else player.CharacterAdded:Wait()
local head = character:WaitForChild("Head")
local humanoid = character:WaitForChild("Humanoid")
local function changeProximityPrompt()
if head.LocalTransparencyModifier >= 1 then
if humanoid.SeatPart and humanoid.SeatPart:IsA("VehicleSeat") then
ProximityPrompt.Enabled = true
else
ProximityPrompt.Enabled = false
end
else
ProximityPrompt.Enabled = false
end
end
head:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(changeProximityPrompt)
humanoid:GetPropertyChangedSignal("SeatPart"):Connect(changeProximityPrompt)