|
| 23 Apr 2014 08:59 PM |
So I have a gate model, I want to make it open and close. Each brick is named Part. How would I set it so it Gets all the children and set their transparency to 1
Would it be something like
Gate1 = game.Workspace.Gate:GetChildren()
Gate1.Transparency = 1
I doubt thats correct but. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 09:03 PM |
this is probably a decently bad way, but it works: name each part something like part1, part2, and put the script in the gate group
script.Parent.Part1.Transparency = 1 script.Parent.Part2.Transparency = 1 script.Parent.Part3.Transparency = 1 script.Parent.Part4.Transparency = 1 -- (etc, etc)
end
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 09:24 PM |
| I don't want to do that, Theres a TON of blocks in my gate, I need it so it gets all the children and turns their transparency to 1 |
|
|
| Report Abuse |
|
|
magoo8
|
  |
| Joined: 25 Apr 2009 |
| Total Posts: 1122 |
|
|
| 23 Apr 2014 09:41 PM |
Function onClick() Gate = script.Parent:clone() Gate.parent = game.Lighting Gate.name = "gate" Gatescript = script:clone() Gatescript.Parent = game.Lighting.gate Script.Parent:remove() Wait(5) Gate.parent = game.Workspace
End
Script.Parent.MouseButton1Clicked:connect(onClick)
--idk if that would work, maybe |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 09:55 PM |
| That won't work due to when I try, it does not move back to its original spot. Maybe because its a CFramed gate. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 10:00 PM |
for i,v in pairs(Gate:GetChildren()) do if v.Name=="Part" then v.Transparency=1 wait(5) v.Transparency=0 end end |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 10:37 PM |
@above that would indivually work on each brick every 5 seconds -_-
for I = 1,2 do for _,v in ipairs(Gate1) do if v.Transparency == 0 then v.Transparency = 1 else v.Transparency = 0 end if v.CanCollide == true then v.CanCollide = false else v.CanCollide = true end end wait(5) end |
|
|
| Report Abuse |
|
|