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: How to set 5 bricks into one function? My version showed too, didn't work..

Previous Thread :: Next Thread 
JamesBond96 is not online. JamesBond96
Joined: 05 Sep 2008
Total Posts: 572
09 Aug 2011 08:18 AM
So if I need onTouch Door1..

Plate1, Plate2, Plate3, Plate4, Plate5 CanCollides = false..?

How to make that?

My version won't do it sadly.

So first I made the variables to make the thing easier, and than I made onTouch the parent all those doors have the same effect, but as for the results, only 1 random door had the effect!

Door = script.Parent.Parent.Door
Door2 = script.Parent.Parent.Door2
Door3 = script.Parent.Parent.Door3
Door4 = script.Parent.Parent.Door4
Door5 = script.Parent.Parent.Door5

function OnTouch(hit)
Door.Transparency = 0.5
Door.CanCollide = false
end

function OnTouch(hit)
Door2.Transparency = 0.5
Door2.CanCollide = false
end

function OnTouch(hit)
Door3.Transparency = 0.5
Door3.CanCollide = false
end

function OnTouch(hit)
Door4.Transparency = 0.5
Door4.CanCollide = false
end

function OnTouch(hit)
Door5.Transparency = 0.5
Door5.CanCollide = false
end


script.Parent.Touched:connect(OnTouch)

Report Abuse
JamesBond96 is not online. JamesBond96
Joined: 05 Sep 2008
Total Posts: 572
09 Aug 2011 08:21 AM
Bump!
Report Abuse
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
09 Aug 2011 08:27 AM
don't put all different lines just do like this
B = script.Parent
B1 = game.Workspace.Brick1
B2 = game.Workspace.Brick2
B3 = game.Workspace.Brick3
B4 = game.Workspace.Brick4
B5 = game.Workspace.Brick5

function onTouched(hit)
B1.stuff = stuff
B2.stuff = stuff
B3.stuff = stuff
B4.stuff = stuff
B5.stuff = stuff
end
B.Touched:connect(onTouched)
Report Abuse
JamesBond96 is not online. JamesBond96
Joined: 05 Sep 2008
Total Posts: 572
09 Aug 2011 09:05 AM
Bump, doesn't work :O
Report Abuse
bikerking300 is not online. bikerking300
Joined: 31 Mar 2010
Total Posts: 1034
09 Aug 2011 09:09 AM
B = script.Parent
B1 = script.Parent.Parent.Door
B2 = script.Parent.Parent.Door2
B3 = script.Parent.Parent.Door3
B4 = script.Parent.Parent.Door4
B5 = script.Parent.Parent.Door5


function onTouched(hit)
B1.CanCollide = false
B1.Transparency = 1
B2.CanCollide = false
B2.Transparency = 1
B3.CanCollide = false
B3.Transparency = 1
B4.CanCollide = false
B4.Transparency = 1
B5.CanCollide = false
B5.Transparency = 1
B.Touched:connect(onTouched)
Report Abuse
bikerking300 is not online. bikerking300
Joined: 31 Mar 2010
Total Posts: 1034
09 Aug 2011 09:10 AM
Oops forgot somthing

B = script.Parent
B1 = script.Parent.Parent.Door
B2 = script.Parent.Parent.Door2
B3 = script.Parent.Parent.Door3
B4 = script.Parent.Parent.Door4
B5 = script.Parent.Parent.Door5


B.Touched:connect(function(hit)
B1.CanCollide = false
B1.Transparency = 1
B2.CanCollide = false
B2.Transparency = 1
B3.CanCollide = false
B3.Transparency = 1
B4.CanCollide = false
B4.Transparency = 1
B5.CanCollide = false
B5.Transparency = 1
end)
Report Abuse
Snej1 is online. Snej1
Joined: 25 Jun 2008
Total Posts: 809
09 Aug 2011 09:14 AM
p = script.Parent.Parent
doors = {p.Door, p.Door2, p.Door3, p.Door4, p.Door5}

for _,door in pairs(doors) do
door.Touched:connect(function()
door.CanCollide = false
door.Transparency = 1
end) end

Is that what you meant?

~ Chrome extensions FTW ~
Report Abuse
JamesBond96 is not online. JamesBond96
Joined: 05 Sep 2008
Total Posts: 572
09 Aug 2011 09:15 AM
@Biker, thanks.. It worked now :D!
Report Abuse
bikerking300 is not online. bikerking300
Joined: 31 Mar 2010
Total Posts: 1034
09 Aug 2011 09:15 AM
Np.
Report Abuse
Snej1 is online. Snej1
Joined: 25 Jun 2008
Total Posts: 809
09 Aug 2011 09:15 AM
Um.. No it wasn't right?

~ Chrome extensions FTW ~
Report Abuse
JamesBond96 is not online. JamesBond96
Joined: 05 Sep 2008
Total Posts: 572
09 Aug 2011 09:18 AM
Oh, snej1, I didn't notice lol. I guess it is right tho I don't know. It is in some kind of harder Lua language.. :O
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