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 » Scripters
Home Search
 

Re: How can I make this script shorter?

Previous Thread :: Next Thread 
Babayooohhh is not online. Babayooohhh
Joined: 25 Jun 2010
Total Posts: 7
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 is not online. 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 is not online. 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
dylanrox44 is not online. dylanrox44
Joined: 15 Apr 2013
Total Posts: 188
15 Apr 2015 02:13 AM
Why would you want it shorter! I do scripts like that.





~Friendly.


Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
15 Apr 2015 02:16 AM
Because it can be more efficient
Report Abuse
DevVince is not online. 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 is not online. 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 is not online. 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
Babayooohhh is not online. Babayooohhh
Joined: 25 Jun 2010
Total Posts: 7
15 Apr 2015 04:21 AM
Okay Thanks

I got it now
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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