|
| 15 Apr 2015 12:39 AM |
function onTouched(hit) wait(2) script.Parent.Parent.Part.Transparency = 1 script.Parent.Parent.Part1.Transparency = 1 script.Parent.Parent.Part2.Transparency = 1 script.Parent.Parent.Part3.Transparency = 1 script.Parent.Parent.Part4.Transparency = 1 script.Parent.Parent.Part5.Transparency = 1 script.Parent.Parent.Part6.Transparency = 1 end script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
lokkut
|
  |
| Joined: 18 Mar 2009 |
| Total Posts: 1794 |
|
|
| 15 Apr 2015 01:39 AM |
local x = {"Part","Part1","Part2","Part3","Part4","Part5","Part6"}
function onTouched(hit) wait(2) for i = 1,#x do script.Parent.Parent[x[i]].Transparency = 1 end end script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 15 Apr 2015 01:52 AM |
Shorter huh?
script.Parent.Touched:connect(function(hit) for i = 1,6 do script.Parent.Parent['Part'..tostring(i)].Transparency = i end end) |
|
|
| Report Abuse |
|
|
|
| 15 Apr 2015 02:13 AM |
Why would you want it shorter! I do scripts like that.
~Friendly.
|
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 15 Apr 2015 02:16 AM |
| Because it can be more efficient |
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 15 Apr 2015 02:17 AM |
script.Parent.Touched:connect(function onTouched() for i,v in pairs(script.Parent.Parent) do if v:IsA'Part' then--and you can even make it check for a name so it only changes the bricks you want if there are more bricks in that area v.Transparency = 1 end end) |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 15 Apr 2015 02:18 AM |
So... shorter as in line count eh?
*Makes 100K character script do the same thing in one line*
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 15 Apr 2015 02:18 AM |
t='Parent's=script[t]s.Touched:connect(loadstring'for i=1,6 do s[t]['Part'..i].Transparency=1')
Whoops. |
|
|
| Report Abuse |
|
|
| |
|