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: Pairs help

Previous Thread :: Next Thread 
1MangoMan0 is not online. 1MangoMan0
Joined: 28 Sep 2010
Total Posts: 1596
06 Dec 2011 10:02 PM
So this script is in a brick that is grouped with a bunch of other bricks. It's supposed to make it look like a door opened then closed, but really different bricks just changed visibility and transparency.
The script does not do anything and has no output. I'm new to pairs so I'm pretty sure the problem lies in that area. Could I get some help please?


mod = script.Parent.Parent -- The model everything is in

cd = mod.cd
cdna = mod.cdna
cdnb = mod.cdnb
cdad = cdna.Decal
cdbd = cdnb.Decal
od = mod.od
odna = mod.odna
odnb = mod.odnb
odad = odna.Decal
odbd = odnb.Decal

t = {cd,cdna,cdad,cdbd,od,odna,odad,odbd}

function openclose(part)
if part.Parent:findFirstChild("Humanoid") and cd.Transparency == 1 then
for i,v in pairs(t) do
if i.ClassName == "Part" then
i.CanCollide = false
end
i.Transparency = 1
end
wait(3)
for i,v in pairs(t) do
if i.ClassName == "Part" then
i.CanCollide = true
end
i.Transparency = 0
end
end
end

script.Parent.Touched:connect(openclose)
Report Abuse
1MangoMan0 is not online. 1MangoMan0
Joined: 28 Sep 2010
Total Posts: 1596
06 Dec 2011 10:07 PM
Actually I figured out why it's not doing anything, now it has an output:
Workspace.Model.cd.Script:19: attempt to index local 'i' (a number value)


mod = script.Parent.Parent -- The model everything is in

cd = mod.cd
cdna = mod.cdna
cdnb = mod.cdnb
cdad = cdna.Decal
cdbd = cdnb.Decal
od = mod.od
odna = mod.odna
odnb = mod.odnb
odad = odna.Decal
odbd = odnb.Decal

t = {cd,cdna,cdad,cdbd,od,odna,odad,odbd}

function openclose(part)
if part.Parent:findFirstChild("Humanoid") and cd.Transparency == 0 then --That should have been 0
for i,v in pairs(t) do
if i.ClassName == "Part" then
i.CanCollide = false
end
i.Transparency = 1
end
wait(3)
for i,v in pairs(t) do
if i.ClassName == "Part" then
i.CanCollide = true
end
i.Transparency = 0
end
end
end

script.Parent.Touched:connect(openclose)

Report Abuse
1MangoMan0 is not online. 1MangoMan0
Joined: 28 Sep 2010
Total Posts: 1596
06 Dec 2011 10:09 PM
Okay never mind, I figured it out :D
Report Abuse
natethegreat2009 is not online. natethegreat2009
Joined: 12 Sep 2009
Total Posts: 2013
06 Dec 2011 10:42 PM
good job :D
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