Is it possible to change a setting in the code where if the camera is zoomed away the proximity prompt is hidden?
I don’t believe there’s a built-in method to do that, but you can accomplish it with code.
Try this:
-- Services --
local RunService = game:GetService("RunService")
-- Constants --
local CURRENTCAMERA = workspace.CurrentCamera
-- Other variables --
local proxPrompts: {ProximityPrompt} = {}
--[[
Sets up the provided proximity prompt to respect the local player's camera distance.
]]
local function setupProximityPrompt(prompt: ProximityPrompt)
table.insert(proxPrompts, prompt)
prompt.Destroying:Once(function()
table.remove(proxPrompts, table.find(proxPrompts, prompt))
end)
end
-- Update proximity prompt visibility every frame
RunService.PostSimulation:Connect(function()
local camPos = CURRENTCAMERA.CFrame.Position
for _, prompt in proxPrompts do
-- Check if prompt has a parent
local originInstance = prompt.Parent
if not originInstance then
continue
end
-- Get origin position
local originPos: Vector3
if originInstance:IsA("BasePart") then
originPos = originInstance.Position
elseif originInstance:IsA("Attachment") then
originPos = originInstance.WorldPosition
else
continue
end
if (originPos-camPos).Magnitude > prompt.MaxActivationDistance then
prompt.Enabled = false
else
prompt.Enabled = true
end
end
end)
setupProximityPrompt(PATH_TO_PROXIMITY_PROMPT) -- I'd recommend using collection service and tags to make implementation a bit easier