|
| 15 Feb 2016 07:03 PM |
door = script.Parent.Parent.Door door1 = script.Parent.Parent.Door1 ON = script.Parent.Parent.ON
function onClicked(mouse) if ON.Value == 0 then door.Transparency = 0 door.CanCollide = true door1.Transparency = 1 door1.CanCollide = false door1.Hotch:play() ON.Value = 1 else door1.Transparency = 0 door1.CanCollide = true door.Transparency = 1 door.CanCollide = false door1.Hotch:play() ON.Value = 0 end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
--
How could I have the script recognize a group(full of multiple parts) as something like "door" instead of one part as "door" So I can use more than two parts for this door script, could some one help me?
[So when you activate the "button" instead of one part dissapearing and another one appearing. Instead a whole group of parts dissapear and a whole other group of parts appear] |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2016 07:08 PM |
getchildren and for loops
choo choo |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2016 07:10 PM |
| I don't know how to script(very well), could you show me an example of where (and what) I should type into the script? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 15 Feb 2016 07:44 PM |
Understanding and having absolute knowledge are two different things believe it or not.
If I say, can some one help me get my rocket into space?
and only get a reply of
"Oh yeah sure, Just use "rocket-fuel" and "aerodynamics".
I understand what those are, but not giving me instruction "or even better an example!" is worse for me than having not asked for help because now I am wasting time typing a salty response. Time that could have been spent trying to figure out my problem by myself as usual, and then giving up two hours and sixteen minutes later because I don't know what the hell I am supposed to code or type. |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2016 07:48 PM |
| I'm going to eat leftover Chinese food and wallow in my depression now. |
|
|
| Report Abuse |
|
|
gamehero
|
  |
| Joined: 12 Jun 2007 |
| Total Posts: 1455 |
|
|
| 15 Feb 2016 08:58 PM |
If "Door" and "Door1" is a model or a folder, use this.
for i,part in pairs(script.Parent.Parent.Door:GetChildren()) do part.Transparency = 1 part.CanCollide = false end
for i,part in pairs(script.Parent.Parent.Door1:GetChildren()) do part.Transparency = 0 part.CanCollide = true end
|
|
|
| Report Abuse |
|
|
|
| 15 Feb 2016 09:52 PM |
ON = script.Parent.Parent.ON Sund = script.Parent.Parent.Door1.Gear
function onClicked(mouse) if ON.Value == 0 then for i,part1 in pairs(script.Parent.Parent.Door1:GetChildren()) do part1.Transparency = 1 part1.CanCollide = false end for i,part1 in pairs(script.Parent.Parent.Door:GetChildren()) do part1.Transparency = 0 part1.CanCollide = true end Sund.Hotch:play() ON.Value = 1
else
for i,part1 in pairs(script.Parent.Parent.Door1:GetChildren()) do part1.Transparency = 0 part1.CanCollide = true end for i,part1 in pairs(script.Parent.Parent.Door:GetChildren()) do part1.Transparency = 1 part1.CanCollide = false end Sund.Hotch:play() ON.Value = 0
end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
-- Thank you Gamehero. |
|
|
| Report Abuse |
|
|