|
| 30 Nov 2014 09:37 PM |
This is a model named doors. There are 2 parts inside it named door1 and door2. When you touch door1 it is supposed to go transparent and become unable to collide and vice versa for door2. It is supposed ot look like the door opens when you touch it. What'd i do wrong?
doors=script.Parent function onTouched(hit) doors['door1'].Transparency=1 doors['door1'].CanCollide=false doors['door2'].Transparency=0 doors['door2'].CanCollide=true wait(5) doors['door1'].Transparency=0 doors['door1'].CanCollide=true doors['door2'].Transparency=1 doors['door2'].CanCollide=false end
Thanks |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 30 Nov 2014 09:42 PM |
doors.Touched:connect(onTouched)
add that to the end. |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2014 09:43 PM |
At the bottom of the script you need to have:
doors['door1'].Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 30 Nov 2014 09:43 PM |
um thats a wierd way to do that,
door1 = script.Parent.door1 door2 = script.Parent.door2
function open(hit) door1.CanCollide = false door1.Transparency = 1 door2.CanCollide = true door2.Transparency = 0 wait(5) door1.CanCollide = true door1.Transparency = 0 door2.CanCollide = false door2.Transparency = 1 end --but you would need to know what is getting hit, door one or door two so.. script.Parent.door1.Touched:connect(open) |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2014 09:44 PM |
| @Coolio a model can't be touched. |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2014 09:45 PM |
| @chimm the great thing about scripting is that there are multiple ways to accomplish the same task. The only question is which way is more efficient |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2014 09:45 PM |
oh yea right XD but it still doesn't work so there is something else i messed up
doors=script.Parent function onTouched(hit) doors['door1'].Transparency=1 doors['door1'].CanCollide=false doors['door2'].Transparency=0 doors['door2'].CanCollide=true wait(5) doors['door1'].Transparency=0 doors['door1'].CanCollide=true doors['door2'].Transparency=1 doors['door2'].CanCollide=false
end script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 30 Nov 2014 09:46 PM |
| "doors['door1']" is longer to write than "door1" |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 30 Nov 2014 09:47 PM |
| a model can not be touched |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2014 09:47 PM |
| ah chim your way worked, thanks! |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 30 Nov 2014 09:48 PM |
| you must have a part that will be touched |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
| |
|
|
| 30 Nov 2014 09:58 PM |
| Oh i get it thanks man it helps! |
|
|
| Report Abuse |
|
|