I made a script that would automatically set the max activation distances and hold durations of click detectors and proximity prompts. However, there are a few situations where the click detectors’ and proximity prompts’ max activation distances would be too close, and thus requiring them to be “excepted” by the script. I tried doing this by adding the excepted prompts to a list, but it doesn’t work and doesn’t set the activation distances and hold durations at all.
Here is the code:
for _,v in pairs(game.Workspace:GetDescendants()) do
local obj = workspace.Objectives
local exceptions = {obj.Obj3Kitchen.ProximityPrompt}
for _,v in ipairs(exceptions) do
if v~= exceptions then
if v:IsA("ClickDetector") then
v.MaxActivationDistance=5
elseif v:IsA("ProximityPrompt") then
v.MaxActivationDistance=5
v.HoldDuration=0.5
end
end
end
end