My friend was making a door that would open but had problems but since he is not a member yet I am posting this for him.
What he want is a group modeled door that will open/close instead of putting it on one part
He said that the issue is that he grouped a door and tried to use close proximity to open and close the door but it won’t work
local ProximityPrompt = script.Parent
local Door = script.Parent.Parent
ProximityPrompt.Triggered:Connect(function()
if ProximityPrompt.ActionText == "Open" then
Door.Transparency = .5
Door.CanCollide = false
ProximityPrompt.ActionText = "Close"
else
Door.Transparency = 0
Door.CanCollide = true
ProximityPrompt.ActionText = "Open"
end
end)
Screenshot of the system -
https://gyazo.com/38bc5e254eaacc1a87db90021d3a68a9
local ProximityPrompt = script.Parent
local Door = script.Parent.Parent
local Union = "Part"
local UnionEnabled = false -- Choose if you want to apply it to a union.
if UnionEnabled == true then
Union = "Union"
end
ProximityPrompt.Triggered:Connect(function()
for i,v in pairs(Door:GetChildren()) do
if v:isA("Part") or v:isA(Union) then
if ProximityPrompt.ActionText == "Open" then
Door.Transparency = .5
Door.CanCollide = false
ProximityPrompt.ActionText = "Close"
else
Door.Transparency = 0
Door.CanCollide = true
ProximityPrompt.ActionText = "Open"
end
end
end
end)
Since “Door” is a model, it won’t work because it’s a model, not a part. Your trying to apply a part property to a model.
If nothing worked so far, then you can try this out:
It is because you are describing the door as a model. I saw these script ones on Youtube, but here’s how to fix them.
Firstly, you gotta Union all the parts used in the Door.
Then:
local ProximityPrompt = script.Parent
local Door = script.Parent.Parent.Union -- The union is the door.
ProximityPrompt.Triggered:Connect(function()
if ProximityPrompt.ActionText == "Open" then
Door.Transparency = .5
Door.CanCollide = false
ProximityPrompt.ActionText = "Close"
else
Door.Transparency = 0
Door.CanCollide = true
ProximityPrompt.ActionText = "Open"
end
end)
If everything of this didn’t work, you gotta enable the ProximityPrompt setting on Beta Features, but if you didn’t find it you might need to be enrolled in the Beta Program.