generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Door script. Problem

Previous Thread :: Next Thread 
bobots is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image