Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I hide every proximity prompt in a place?

Asked by 2 years ago

I've been working on a security camera system and I need every proximity prompt to be hidden when the cameras are being used. However I've been struggling. I've tried using a for loop however no look.

local function DisablePrompts(Parentt)
    for i = 1, #Parentt:GetChildren() do
        if Parentt:GetChildren()[i]:IsA("ProximityPrompt") then
            Parentt:GetChildren()[i].MaxActivationDistance = 0
        else
            DisablePrompts(Parentt:GetChildren()[i])
        end
    end
end

I hope someone has a solution. Thank you in advanced!

2 answers

Log in to vote
0
Answered by
Voruel 41
2 years ago

Try Parentt:GetDescendants()

local function DisablePrompt(Parentt)
    for _, ProximityPrompt in ipairs(Parentt:GetDescendants()) do
       ProximityPrompt.Enabled = false
    end
end
1
just incase you would want to do a check if its a ProximityPrompt Puppynniko 1059 — 2y
Ad
Log in to vote
0
Answered by
Xeqro 20
2 years ago

Can't you just use ProximityPrompt.Enabled = false?

0
I'm trying to hide every instance of any proximity prompts in the entire place so sadly not. Glitxhxd 6 — 2y

Answer this question