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: Pair Loop

Previous Thread :: Next Thread 
FinalNight is not online. FinalNight
Joined: 22 Mar 2011
Total Posts: 379
15 Oct 2011 04:28 PM
Parts = script.Parent.Parent:GetChildren()
function onTouch(hit)
human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
for i, v in pairs(Parts) do
v.Decal.Transparency = 1 --Probably messed up here.
v.CanCollide = false
wait(3)
v.Decal.Transparency = 0
v.CanCollide = true
end
end
end
--Okay, I'm new to these scripts. I'm assuming I messed up with the "v", but I may have messed up somewhere else.
--When I checked Output, nothing was wrong.
--The script is a Child of Part1, which is a Child of Model, which also contains Part2, Part3, and Part4. They all have a Decal in them.
--Thanks for the help!
-FinalNight
Report Abuse
FinalNight is not online. FinalNight
Joined: 22 Mar 2011
Total Posts: 379
15 Oct 2011 04:41 PM
Ugh bad title.. D:
Report Abuse
GoldenUrg is not online. GoldenUrg
Joined: 23 Aug 2009
Total Posts: 6428
15 Oct 2011 04:47 PM
Your onTouch function is never called. Perhaps you're missing a connect?
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
15 Oct 2011 04:51 PM
Along with what Golden said, in your script, the loop will run for each of the objects one at a time. That means, it will run first for one of the parts, and it will change the Transparency and CanCollide (do Decals even have Transparency?), then wait 3 seconds, then change them back. Only after that will it move on to changing the rest of the parts, one by one. What you might want to do is use one loop to change the transparency/cancollide to 1 and false for all of them, then wait 3 seconds, then use another loop to change them back.
Report Abuse
FinalNight is not online. FinalNight
Joined: 22 Mar 2011
Total Posts: 379
15 Oct 2011 04:59 PM
Okay, thanks. I hate (and forget) Event Listeners all the time.
Report Abuse
FinalNight is not online. FinalNight
Joined: 22 Mar 2011
Total Posts: 379
15 Oct 2011 05:06 PM
Ugh, it's complaining about my Event Listeners. :L I used:
Parts.Touched:connect(onTouched)
Then it keeps giving me an error saying "Touched is a nil value", but it's an Event. :s
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
15 Oct 2011 05:08 PM
Parts is a table of Parts, not an actual Part.

You can either choose one Part to connect the event to, or use a loop to connect it to all of them.
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