bobots
|
  |
| Joined: 25 Feb 2010 |
| Total Posts: 410 |
|
|
| 21 Dec 2012 06:18 AM |
Whenever I press the button to open the door, nothing happends, nothing at the output or anything, The material of the door is Grass, and is green,
Here is the script actually
function click() if game.Workspace.Door.Material == "Grass" then game.Workspace.Door.Material = "Plastic" game.Workspace.Door.Transparency = 0.1 wait(0.1) game.Workspace.Door.Transparency = 0.2 wait(0.1) game.Workspace.Door.Transparency = 0.3 wait(0.1) game.Workspace.Door.Transparency = 0.4 wait(0.1) game.Workspace.Door.Transparency = 0.5 wait(0.1) game.Workspace.Door.Transparency = 0.6 wait(0.1) game.Workspace.Door.Transparency = 0.7 game.Workspace.CanCollide = false wait(0.1) game.Workspace.Door.Transparency = 0.8 wait(0.1) game.Workspace.Door.Transparency = 0.9 wait(0.1) game.Workspace.Door.Transparency = 1 game.Workspace.Button.BrickColor = BrickColor.new("Bright green") end end
function click2() if game.Workspace.Door.Material == "Plastic" then game.Workspace.Door.Material = "Grass" game.Workspace.Door.Transparency = 0.9 wait(0.1) game.Workspace.Door.Transparency = 0.8 wait(0.1) game.Workspace.Door.Transparency = 0.7 wait(0.1) game.Workspace.Door.Transparency = 0.5 wait(0.1) game.Workspace.Door.Transparency = 0.4 wait(0.1) game.Workspace.Door.Transparency = 0.3 wait(0.1) game.Workspace.Door.Transparency = 0.2 game.Workspace.CanCollide = true wait(0.1) game.Workspace.Door.Transparency = 0.1 wait(0.1) game.Workspace.Door.Transparency = 0.1 wait(0.1) game.Workspace.Door.Transparency = 0 game.Workspace.Button.BrickColor = BrickColor.new("Really red") end end
script.Parent.ClickDetector.MouseClick:connect(click) script.Parent.ClickDetector.MouseClick:connect(click2)
|
|
|
| Report Abuse |
|
|
Azarth
|
  |
| Joined: 17 Aug 2012 |
| Total Posts: 2760 |
|
|
| 21 Dec 2012 06:45 AM |
You can't have two of the same connections. The script won't know what to do.
script.Parent.ClickDetector.MouseClick:connect(click) script.Parent.ClickDetector.MouseClick:connect(click2) |
|
|
| Report Abuse |
|
|
bobots
|
  |
| Joined: 25 Feb 2010 |
| Total Posts: 410 |
|
|
| 21 Dec 2012 06:58 AM |
It still dont work, I changed the script to
--m function click() if game.Workspace.Door.Material == "Grass" then game.Workspace.Door.Material = "Plastic" game.Workspace.Door.Transparency = 0.1 wait(0.1) game.Workspace.Door.Transparency = 0.2 wait(0.1) game.Workspace.Door.Transparency = 0.3 wait(0.1) game.Workspace.Door.Transparency = 0.4 wait(0.1) game.Workspace.Door.Transparency = 0.5 wait(0.1) game.Workspace.Door.Transparency = 0.6 wait(0.1) game.Workspace.Door.Transparency = 0.7 game.Workspace.Door.CanCollide = false wait(0.1) game.Workspace.Door.Transparency = 0.8 wait(0.1) game.Workspace.Door.Transparency = 0.9 wait(0.1) game.Workspace.Door.Transparency = 1 game.Workspace.Button.BrickColor = BrickColor.new("Bright green") elseif game.Workspace.Door.Material == "Plastic" then game.Workspace.Door.Material = "Grass" game.Workspace.Door.Transparency = 0.9 wait(0.1) game.Workspace.Door.Transparency = 0.8 wait(0.1) game.Workspace.Door.Transparency = 0.7 wait(0.1) game.Workspace.Door.Transparency = 0.5 wait(0.1) game.Workspace.Door.Transparency = 0.4 wait(0.1) game.Workspace.Door.Transparency = 0.3 wait(0.1) game.Workspace.Door.Transparency = 0.2 game.Workspace.Door.CanCollide = true wait(0.1) game.Workspace.Door.Transparency = 0.1 wait(0.1) game.Workspace.Door.Transparency = 0.1 wait(0.1) game.Workspace.Door.Transparency = 0 game.Workspace.Button.BrickColor = BrickColor.new("Really red") end end script.Parent.ClickDetector.MouseClick:connect(click)
|
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 21 Dec 2012 06:59 AM |
function click() if game.Workspace.Door.Material == "Grass" then game.Workspace.Door.Material = "Plastic" game.Workspace.Door.Transparency = 0.1 wait(0.1) game.Workspace.Door.Transparency = 0.2 wait(0.1) game.Workspace.Door.Transparency = 0.3 wait(0.1) game.Workspace.Door.Transparency = 0.4 wait(0.1) game.Workspace.Door.Transparency = 0.5 wait(0.1) game.Workspace.Door.Transparency = 0.6 wait(0.1) game.Workspace.Door.Transparency = 0.7 game.Workspace.CanCollide = false wait(0.1) game.Workspace.Door.Transparency = 0.8 wait(0.1) game.Workspace.Door.Transparency = 0.9 wait(0.1) game.Workspace.Door.Transparency = 1 game.Workspace.Button.BrickColor = BrickColor.new("Bright green") else game.Workspace.Door.Material = "Grass" game.Workspace.Door.Transparency = 0.9 wait(0.1) game.Workspace.Door.Transparency = 0.8 wait(0.1) game.Workspace.Door.Transparency = 0.7 wait(0.1) game.Workspace.Door.Transparency = 0.5 wait(0.1) game.Workspace.Door.Transparency = 0.4 wait(0.1) game.Workspace.Door.Transparency = 0.3 wait(0.1) game.Workspace.Door.Transparency = 0.2 game.Workspace.CanCollide = true wait(0.1) game.Workspace.Door.Transparency = 0.1 wait(0.1) game.Workspace.Door.Transparency = 0.1 wait(0.1) game.Workspace.Door.Transparency = 0 game.Workspace.Button.BrickColor = BrickColor.new("Really red") end end
script.Parent.ClickDetector.MouseClick:connect(click) |
|
|
| Report Abuse |
|
|
Azarth
|
  |
| Joined: 17 Aug 2012 |
| Total Posts: 2760 |
|
|
| 21 Dec 2012 07:02 AM |
local door = Workspace["Door"] local Button = Workspace["Button"]
script.Parent.ClickDetector.MouseClick:connect(function() if door.Material == "Grass" then print("grass") door.Material = "Plastic" Button.BrickColor = BrickColor.new("Bright green") for i = 0,1,.1 do door.Transparency = i wait() end elseif door.Material == "Plastic" then print("plastic") door.Material = "Grass" Button.BrickColor = BrickColor.new("Really red") for i = 1,0,-.1 do door.Transparency = i wait() end end end)
|
|
|
| Report Abuse |
|
|
bobots
|
  |
| Joined: 25 Feb 2010 |
| Total Posts: 410 |
|
|
| 21 Dec 2012 07:13 AM |
It still dont work, the outpot doesnt say anything
local door = Workspace["Door"] local Button = Workspace["Button"]
script.Parent.ClickDetector.MouseClick:connect(function() if door.Material == "Grass" then print("grass") door.Material = "Plastic" Button.BrickColor = BrickColor.new("Bright green") for i = 0,1,.1 do door.Transparency = i wait() end elseif door.Material == "Plastic" then print("plastic") door.Material = "Grass" Button.BrickColor = BrickColor.new("Really red") for i = 1,0,-.1 do door.Transparency = i wait() end end end) |
|
|
| Report Abuse |
|
|
Azarth
|
  |
| Joined: 17 Aug 2012 |
| Total Posts: 2760 |
|
|
| 21 Dec 2012 07:23 AM |
| hm I tried it. It detects when you click, but it's not responding to the bricks material. Very weird. |
|
|
| Report Abuse |
|
|
Kondou
|
  |
| Joined: 05 Aug 2012 |
| Total Posts: 1148 |
|
|
| 21 Dec 2012 07:53 AM |
Well, I couldn't figure out your door, however I got your idea to work.
Setup:
Model Door, Close, Open
In the close button: ClickDetector Script
Close Button Script:
function door()
script.Parent.Parent.Door.Transparency = 0 script.Parent.Parent.Door.CanCollide = true script.Parent.Parent.Door.Material = 1280 end
script.Parent.ClickDetector.MouseClick:connect(door)
In the open button: ClickDetector Script
Open Button Script:
function door()
script.Parent.Parent.Door.Transparency = 0.7 script.Parent.Parent.Door.CanCollide = false script.Parent.Parent.Door.Material = 256 end
script.Parent.ClickDetector.MouseClick:connect(door)
|
|
|
| Report Abuse |
|
|
Kondou
|
  |
| Joined: 05 Aug 2012 |
| Total Posts: 1148 |
|
|
| 21 Dec 2012 07:53 AM |
Also, the reason I used numbers at the material areas is you can not simply put the name of the material (As far as I'm aware). You must use the enum Value.
http://wiki.roblox.com/index.php/Changing_Brick_Materials |
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 21 Dec 2012 09:40 AM |
Your script works.
BUT.
Transparencies/reflectances in between 0 and 1 only work on PLASTIC bricks. |
|
|
| Report Abuse |
|
|
bobots
|
  |
| Joined: 25 Feb 2010 |
| Total Posts: 410 |
|
|
| 21 Dec 2012 04:01 PM |
| My idea was to have open and close in the same button and script. |
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 22 Dec 2012 04:41 PM |
| Or try writing Enum.Material.Plastic instead of "Plastic"... |
|
|
| Report Abuse |
|
|