Basically, I’m trying to make a door that you can unlock by triggering a proximityprompt.
However, out of all the parts, only 1 becomes transparency 0.6 and after that, it selects another random part?
Script:
local house = script.Parent
local prox = Instance.new("ProximityPrompt")
for i, v in pairs(house:GetDescendants()) do
if v:IsA("BasePart") and v.BrickColor == BrickColor.new("Really black") then
prox.Parent = v
prox.ActionText = "Open"
prox.ObjectText = "Door"
prox.RequiresLineOfSight = false
prox.HoldDuration = 5
prox.MaxActivationDistance = 12
end
end
prox.Triggered:Connect(function()
local door = prox.Parent.Parent
for i, v in pairs(door:GetChildren()) do
if v:IsA("BasePart") and v.Color ~= Color3.new(160, 95, 53) then
v.Transparency = .6
v.CanCollide = false
wait(6)
v.Transparency = 0
v.CanCollide = true
end
end
end)