|
| 21 Jul 2011 10:14 AM |
Hello everyone! I am trying to work on a script so that when I (ONLY me) say "open" or "close," the door will open or close. I'm a little new to the scripting thing, but I think i'm getting the hang of it. Here is what my script looks like now:
door = script.Parent
game.Players.ChildAdded:connect(function(player) if player.Name == "yellowcrash10" then player.Chatted:connect(function(msg)
if (msg == "open") then door.CanCollide = false door.Transparency = 0.4
if (msg == "close") then door.CanCollide = true door.Transparency = 0 end end end end)
I'm sure it's entirely messed up, but does anyone see any problems? |
|
|
| Report Abuse |
|
|
Ozzypig
|
  |
| Joined: 27 Mar 2008 |
| Total Posts: 4906 |
|
|
| 21 Jul 2011 10:17 AM |
I wouldn't use an anonymous function right there, but oh well.
You should also being using if-elseif blocks.
example:
if msg == "open" then --code elseif msg == "close" then --code end
You'll only need one end statement.
~Ozzy |
|
|
| Report Abuse |
|
|
|
| 21 Jul 2011 10:30 AM |
| Thanks for the help! Would the anonymous work in the first place? |
|
|
| Report Abuse |
|
|
Ozzypig
|
  |
| Joined: 27 Mar 2008 |
| Total Posts: 4906 |
|
|
| 21 Jul 2011 10:30 AM |
| Yes, but in this kind of case you can use it. |
|
|
| Report Abuse |
|
|
| |
|