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

How do i make it so when multiple parts are visible, a block will vanish?

Asked by 4 years ago
Edited 4 years ago

I am making an escape the night map and i want to make it so when all "orbs" show the block slowly disappears which will reveal the town. What I tried is not working, help.

Heres my attempt:

sphere = script.Parent 




game.Workspace.Orbs.Orb1a,Orb2a,Orb3a:GetPropertyChangedSignal("Transparency"):Connect(function()
 if game.Workspace.Orbs.Orb1a.Transparency == 0 and game.Workspace.Orbs.Orb2a.Transparency == 0 and game.Workspace.Orbs.Orb3a.Transparency == 0 then
  repeat
 sphere.Transparency = Vector3.new( 0, a, 0) 
 wait(.01) 
 a = a+.01 
 until sphere.Transparency == 1 

1 answer

Log in to vote
0
Answered by 4 years ago

A possible solution that you could do is use an infinite loop, and then check to see if the parts are transparent. I would recommend putting the parts into a folder to separate them into a section for you to access. Here's a little example.

while wait() do
    for i, v in pairs(workspace.OrbFolder:GetChilderen()) do
        if v:IsA("BasePart") then
            if v.Transparency = 0 then
                -- From here on, how you want to make it slowly reveal itself is up to you if you want to tween the transparency or do a while loop and adjust the transparency yourself, is up to you.
            end
        end
    end
end
Ad

Answer this question